X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcfg.go;h=ee8f4c63c348896f2fdf212b52a5112ca3e74f7f;hb=0367cce2741e1ce6a89a49fd5c4e9df6005c9744;hp=22da596baf206e6e61447d9ddd8974c5f55aa915;hpb=2758c63b64cf12e5f457daeb78e830959d26faae;p=nncp.git diff --git a/src/cfg.go b/src/cfg.go index 22da596..ee8f4c6 100644 --- a/src/cfg.go +++ b/src/cfg.go @@ -1,6 +1,6 @@ /* NNCP -- Node to Node copy, utilities for store-and-forward data exchange -Copyright (C) 2016-2021 Sergey Matveev +Copyright (C) 2016-2022 Sergey Matveev This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,6 +21,7 @@ import ( "bytes" "encoding/json" "errors" + "fmt" "log" "os" "path" @@ -190,7 +191,7 @@ func NewNode(name string, cfg NodeJSON) (*Node, error) { } var freqPath *string - freqChunked := int64(MaxFileSize) + var freqChunked int64 var freqMinSize int64 freqMaxSize := int64(MaxFileSize) if cfg.Freq != nil { @@ -445,6 +446,9 @@ func NewArea(ctx *Ctx, name string, cfg *AreaJSON) (*Area, error) { copy(area.Pub[:], pub) } if cfg.Prv != nil { + if area.Pub == nil { + return nil, fmt.Errorf("area %s: prv requires pub presence", name) + } prv, err := Base32Codec.DecodeString(*cfg.Prv) if err != nil { return nil, err