]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/cfg.go
freq.maxsize configuration file option
[nncp.git] / src / cfg.go
index ab8ec7f6d73c0925fe71b0a8c0cd633666275d80..46e6bba6eab537a542f98619a9f19fc86964ed54 100644 (file)
@@ -68,6 +68,7 @@ type NodeFreqJSON struct {
        Path    *string `json:"path,omitempty"`
        Chunked *uint64 `json:"chunked,omitempty"`
        MinSize *uint64 `json:"minsize,omitempty"`
+       MaxSize *uint64 `json:"maxsize,omitempty"`
 }
 
 type CallJSON struct {
@@ -157,6 +158,7 @@ func NewNode(name string, yml NodeJSON) (*Node, error) {
        var freqPath *string
        freqChunked := int64(MaxFileSize)
        var freqMinSize int64
+       freqMaxSize := int64(MaxFileSize)
        if yml.Freq != nil {
                f := yml.Freq
                if f.Path != nil {
@@ -175,6 +177,9 @@ func NewNode(name string, yml NodeJSON) (*Node, error) {
                if f.MinSize != nil {
                        freqMinSize = int64(*f.MinSize) * 1024
                }
+               if f.MaxSize != nil {
+                       freqMaxSize = int64(*f.MaxSize) * 1024
+               }
        }
 
        defRxRate := 0
@@ -278,6 +283,7 @@ func NewNode(name string, yml NodeJSON) (*Node, error) {
                FreqPath:       freqPath,
                FreqChunked:    freqChunked,
                FreqMinSize:    freqMinSize,
+               FreqMaxSize:    freqMaxSize,
                Calls:          calls,
                Addrs:          yml.Addrs,
                RxRate:         defRxRate,