From 6c0f48ec24a706ef3e2095acab0e399074095923 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sun, 10 Jun 2018 13:20:57 +0300 Subject: [PATCH] Satisfy go vet --- src/cypherpunks.ru/nncp/cfg.go | 44 +++++++++++++++++----------------- src/cypherpunks.ru/nncp/pkt.go | 6 ++--- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/cypherpunks.ru/nncp/cfg.go b/src/cypherpunks.ru/nncp/cfg.go index b751961..5d5d66f 100644 --- a/src/cypherpunks.ru/nncp/cfg.go +++ b/src/cypherpunks.ru/nncp/cfg.go @@ -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) { diff --git a/src/cypherpunks.ru/nncp/pkt.go b/src/cypherpunks.ru/nncp/pkt.go index b1c506a..63c0a10 100644 --- a/src/cypherpunks.ru/nncp/pkt.go +++ b/src/cypherpunks.ru/nncp/pkt.go @@ -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 { -- 2.48.1