diff options
-rw-r--r-- | datastructs.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/datastructs.go b/datastructs.go index 25220c5..a4ac45c 100644 --- a/datastructs.go +++ b/datastructs.go @@ -1,6 +1,7 @@ package main import ( + "errors" "time" ) @@ -12,8 +13,14 @@ type RawData struct { packetSize int } -func (rd *RawData) getVolSize() string { - return "medium" +func (rd *RawData) getVolSize(conf Config) (string, error) { + for _, volume := range conf.Volumes { + if volume.Lower <= rd.packetSize && + (rd.packetSize < volume.Upper || volume.Upper == 0) { + return volume.Size, nil + } + } + return "N/A", errors.New("Could not find a fitting size volume") } type CleanData struct { |