]> Cypherpunks.ru repositories - nncp.git/commitdiff
Satisfy go vet
authorSergey Matveev <stargrave@stargrave.org>
Sun, 10 Jun 2018 10:20:57 +0000 (13:20 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sun, 10 Jun 2018 10:20:57 +0000 (13:20 +0300)
src/cypherpunks.ru/nncp/cfg.go
src/cypherpunks.ru/nncp/pkt.go

index b75196175e429b89f7408789fd932077bafd8cfd..5d5d66f7e700c36ae35831abee277a9a3899f17f 100644 (file)
@@ -48,28 +48,28 @@ type NodeYAML struct {
        Id          string
        ExchPub     string
        SignPub     string
-       NoisePub    *string             `noisepub,omitempty`
-       Exec        map[string][]string `exec,omitempty`
-       Incoming    *string             `incoming,omitempty`
-       Freq        *string             `freq,omitempty`
-       FreqChunked *uint64             `freqchunked,omitempty`
-       FreqMinSize *uint64             `freqminsize,omitempty`
-       Via         []string            `via,omitempty`
-       Calls       []CallYAML          `calls,omitempty`
-
-       Addrs map[string]string `addrs,omitempty`
-
-       OnlineDeadline *uint `onlinedeadline,omitempty`
-       MaxOnlineTime  *uint `maxonlinetime,omitempty`
+       NoisePub    *string             `yaml:"noisepub,omitempty"`
+       Exec        map[string][]string `yaml:"exec,omitempty"`
+       Incoming    *string             `yaml:"incoming,omitempty"`
+       Freq        *string             `yaml:"freq,omitempty"`
+       FreqChunked *uint64             `yaml:"freqchunked,omitempty"`
+       FreqMinSize *uint64             `yaml:"freqminsize,omitempty"`
+       Via         []string            `yaml:"via,omitempty"`
+       Calls       []CallYAML          `yaml:"calls,omitempty"`
+
+       Addrs map[string]string `yaml:"addrs,omitempty"`
+
+       OnlineDeadline *uint `yaml:"onlinedeadline,omitempty"`
+       MaxOnlineTime  *uint `yaml:"maxonlinetime,omitempty"`
 }
 
 type CallYAML struct {
        Cron           string
-       Nice           *int    `nice,omitempty`
-       Xx             string  `xx,omitempty`
-       Addr           *string `addr,omitempty`
-       OnlineDeadline *uint   `onlinedeadline,omitempty`
-       MaxOnlineTime  *uint   `maxonlinetime,omitempty`
+       Nice           *int    `yaml:"nice,omitempty"`
+       Xx             string  `yaml:"xx,omitempty"`
+       Addr           *string `yaml:"addr,omitempty"`
+       OnlineDeadline *uint   `yaml:"onlinedeadline,omitempty"`
+       MaxOnlineTime  *uint   `yaml:"maxonlinetime,omitempty"`
 }
 
 type NodeOurYAML struct {
@@ -88,17 +88,17 @@ type FromToYAML struct {
 }
 
 type NotifyYAML struct {
-       File *FromToYAML `file,omitempty`
-       Freq *FromToYAML `freq,omitempty`
+       File *FromToYAML `yaml:"file,omitempty"`
+       Freq *FromToYAML `yaml:"freq,omitempty"`
 }
 
 type CfgYAML struct {
-       Self  *NodeOurYAML `self,omitempty`
+       Self  *NodeOurYAML `yaml:"self,omitempty"`
        Neigh map[string]NodeYAML
 
        Spool  string
        Log    string
-       Notify *NotifyYAML `notify,omitempty`
+       Notify *NotifyYAML `yaml:"notify,omitempty"`
 }
 
 func NewNode(name string, yml NodeYAML) (*Node, error) {
index b1c506a590d4ec816a61ac030781aa2645a7a8ea..63c0a1032f540681b466873afcb2055d316484ff 100644 (file)
@@ -253,7 +253,7 @@ func PktEncWrite(our *NodeOur, their *Node, pkt *Pkt, nice uint8, size, padSize
        if err != nil {
                return err
        }
-       lr := io.LimitedReader{data, size}
+       lr := io.LimitedReader{R: data, N: size}
        mr := io.MultiReader(&pktBuf, &lr)
        mw := io.MultiWriter(out, mac)
        fullSize := pktBuf.Len() + int(size)
@@ -271,7 +271,7 @@ func PktEncWrite(our *NodeOur, their *Node, pkt *Pkt, nice uint8, size, padSize
                if _, err = io.ReadFull(kdf, keyEnc[:]); err != nil {
                        return err
                }
-               lr = io.LimitedReader{DevZero{}, padSize}
+               lr = io.LimitedReader{R: DevZero{}, N: padSize}
                written, err = ae(keyEnc, &lr, out)
                if err != nil {
                        return err
@@ -373,7 +373,7 @@ func PktEncRead(our *NodeOur, nodes map[NodeId]*Node, data io.Reader, out io.Wri
        }
 
        fullSize := PktOverhead + size - 8 - 2*blake2b.Size256
-       lr := io.LimitedReader{data, fullSize}
+       lr := io.LimitedReader{R: data, N: fullSize}
        tr := io.TeeReader(&lr, mac)
        written, err := ae(keyEnc, tr, out)
        if err != nil {