warcer: ["/path/to/warcer.sh"]
wgeter: ["/path/to/wgeter.sh"]
}
- freq: "/home/bob/pub"
- freqchunked: 1024
- freqminsize: 2048
+ freq: {
+ path: "/home/bob/pub"
+ chunked: 1024
+ minsize: 2048
+ }
via: ["alice"]
rxrate: 10
txrate: 20
omitted to forbid file uploading on that node.
@anchor{CfgFreq}
-@item freq
+@item freq.path
Full path to directory from where file requests will queue files for
transmission. May be omitted to forbid freqing from that node.
-@item freqchunked
+@item freq.chunked
If set, then enable @ref{Chunked, chunked} file transmission during
freqing. This is the desired chunk size in KiBs.
-@item freqminsize
+@item freq.minsize
If set, then apply @ref{OptMinSize, -minsize} option during file
transmission.
)
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"`
+}
+
type CallJSON struct {
Cron string
Nice *string `json:"nice,omitempty"`
incoming = &inc
}
- var freq *string
+ var freqPath *string
+ var freqChunked int64
+ var freqMinSize int64
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
}
- 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,
Calls: calls,
dst := string(dstRaw)
sds["dst"] = dst
sender := ctx.Neigh[*job.PktEnc.Sender]
- freq := sender.Freq
- if freq == nil {
+ freqPath := sender.FreqPath
+ if freqPath == nil {
ctx.LogE("rx", sds, "freqing is not allowed")
isBad = true
goto Closing
err = ctx.TxFile(
sender,
pkt.Nice,
- filepath.Join(*freq, src),
+ filepath.Join(*freqPath, src),
dst,
sender.FreqMinSize,
)
err = ctx.TxFileChunked(
sender,
pkt.Nice,
- filepath.Join(*freq, src),
+ filepath.Join(*freqPath, src),
dst,
sender.FreqMinSize,
sender.FreqChunked,