)
type NodeJSON struct {
- Id string `json:"id"`
- ExchPub string `json:"exchpub"`
- SignPub string `json:"signpub"`
- NoisePub *string `json:"noisepub,omitempty"`
- Exec map[string][]string `json:"exec,omitempty"`
- Incoming *string `json:"incoming,omitempty"`
- Freq *string `json:"freq,omitempty"`
- FreqChunked *uint64 `json:"freqchunked,omitempty"`
- FreqMinSize *uint64 `json:"freqminsize,omitempty"`
- Via []string `json:"via,omitempty"`
- Calls []CallJSON `json:"calls,omitempty"`
+ Id string `json:"id"`
+ ExchPub string `json:"exchpub"`
+ SignPub string `json:"signpub"`
+ NoisePub *string `json:"noisepub,omitempty"`
+ Exec map[string][]string `json:"exec,omitempty"`
+ Incoming *string `json:"incoming,omitempty"`
+ Freq *NodeFreqJSON `json:"freq,omitempty"`
+ Via []string `json:"via,omitempty"`
+ Calls []CallJSON `json:"calls,omitempty"`
Addrs map[string]string `json:"addrs,omitempty"`
MaxOnlineTime *uint `json:"maxonlinetime,omitempty"`
}
+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 {
Cron string
Nice *string `json:"nice,omitempty"`
}
type NotifyJSON struct {
- File *FromToJSON `json:"file,omitempty"`
- Freq *FromToJSON `json:"freq,omitempty"`
+ File *FromToJSON `json:"file,omitempty"`
+ Freq *FromToJSON `json:"freq,omitempty"`
+ Exec map[string]*FromToJSON `json:"exec,omitempty"`
}
type CfgJSON struct {
Log string `json:"log"`
Umask string `json:"umask",omitempty`
+ OmitPrgrs bool `json:"noprogress",omitempty`
+
Notify *NotifyJSON `json:"notify,omitempty"`
Self *NodeOurJSON `json:"self"`
incoming = &inc
}
- var freq *string
+ var freqPath *string
+ freqChunked := int64(MaxFileSize)
+ var freqMinSize int64
+ freqMaxSize := int64(MaxFileSize)
if yml.Freq != nil {
- fr := path.Clean(*yml.Freq)
- if !path.IsAbs(fr) {
- return nil, errors.New("Freq path must be absolute")
+ f := yml.Freq
+ if f.Path != nil {
+ fPath := path.Clean(*f.Path)
+ if !path.IsAbs(fPath) {
+ return nil, errors.New("freq.path path must be absolute")
+ }
+ freqPath = &fPath
}
- freq = &fr
- }
- var freqChunked int64
- if yml.FreqChunked != nil {
- if *yml.FreqChunked == 0 {
- return nil, errors.New("freqchunked value must be greater than zero")
+ if f.Chunked != nil {
+ if *f.Chunked == 0 {
+ return nil, errors.New("freq.chunked value must be greater than zero")
+ }
+ freqChunked = int64(*f.Chunked) * 1024
+ }
+ if f.MinSize != nil {
+ freqMinSize = int64(*f.MinSize) * 1024
+ }
+ if f.MaxSize != nil {
+ freqMaxSize = int64(*f.MaxSize) * 1024
}
- freqChunked = int64(*yml.FreqChunked) * 1024
- }
- var freqMinSize int64
- if yml.FreqMinSize != nil {
- freqMinSize = int64(*yml.FreqMinSize) * 1024
}
defRxRate := 0
SignPub: ed25519.PublicKey(signPub),
Exec: yml.Exec,
Incoming: incoming,
- Freq: freq,
+ FreqPath: freqPath,
FreqChunked: freqChunked,
FreqMinSize: freqMinSize,
+ FreqMaxSize: freqMaxSize,
Calls: calls,
Addrs: yml.Addrs,
RxRate: defRxRate,
rInt := int(r)
umaskForce = &rInt
}
+ showPrgrs := true
+ if cfgJSON.OmitPrgrs {
+ showPrgrs = false
+ }
ctx := Ctx{
Spool: spoolPath,
LogPath: logPath,
UmaskForce: umaskForce,
+ ShowPrgrs: showPrgrs,
Self: self,
Neigh: make(map[NodeId]*Node, len(cfgJSON.Neigh)),
Alias: make(map[string]*NodeId),
if cfgJSON.Notify.Freq != nil {
ctx.NotifyFreq = cfgJSON.Notify.Freq
}
+ if cfgJSON.Notify.Exec != nil {
+ ctx.NotifyExec = cfgJSON.Notify.Exec
+ }
}
vias := make(map[NodeId][]string)
for name, neighJSON := range cfgJSON.Neigh {