]> Cypherpunks.ru repositories - nncp.git/commitdiff
Split long lines
authorSergey Matveev <stargrave@stargrave.org>
Sun, 10 Jun 2018 15:17:16 +0000 (18:17 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sun, 10 Jun 2018 15:32:39 +0000 (18:32 +0300)
src/cypherpunks.ru/nncp/call.go
src/cypherpunks.ru/nncp/pkt.go
src/cypherpunks.ru/nncp/pkt_test.go
src/cypherpunks.ru/nncp/sp.go
src/cypherpunks.ru/nncp/toss.go
src/cypherpunks.ru/nncp/tx.go

index fbdd05b014d2244061ebdab9af65d27f8b26414a..6a2c38b740870f249c05162732b3b059c0adba20 100644 (file)
@@ -36,7 +36,13 @@ type Call struct {
        MaxOnlineTime  uint
 }
 
-func (ctx *Ctx) CallNode(node *Node, addrs []string, nice uint8, xxOnly TRxTx, rxRate, txRate int, onlineDeadline, maxOnlineTime uint) (isGood bool) {
+func (ctx *Ctx) CallNode(
+       node *Node,
+       addrs []string,
+       nice uint8,
+       xxOnly TRxTx,
+       rxRate, txRate int,
+       onlineDeadline, maxOnlineTime uint) (isGood bool) {
        for _, addr := range addrs {
                sds := SDS{"node": node.Id, "addr": addr}
                ctx.LogD("call", sds, "dialing")
index 63c0a1032f540681b466873afcb2055d316484ff..855037dc9a96f9f1f16e569cb180da6f280cc848 100644 (file)
@@ -174,7 +174,14 @@ func ae(keyEnc *[32]byte, r io.Reader, w io.Writer) (int, error) {
        return written, nil
 }
 
-func PktEncWrite(our *NodeOur, their *Node, pkt *Pkt, nice uint8, size, padSize int64, data io.Reader, out io.Writer) error {
+func PktEncWrite(
+       our *NodeOur,
+       their *Node,
+       pkt *Pkt,
+       nice uint8,
+       size, padSize int64,
+       data io.Reader,
+       out io.Writer) error {
        pubEph, prvEph, err := box.GenerateKey(rand.Reader)
        if err != nil {
                return err
@@ -298,7 +305,11 @@ func TbsVerify(our *NodeOur, their *Node, pktEnc *PktEnc) (bool, error) {
        return ed25519.Verify(their.SignPub, tbsBuf.Bytes(), pktEnc.Sign[:]), nil
 }
 
-func PktEncRead(our *NodeOur, nodes map[NodeId]*Node, data io.Reader, out io.Writer) (*Node, int64, error) {
+func PktEncRead(
+       our *NodeOur,
+       nodes map[NodeId]*Node,
+       data io.Reader,
+       out io.Writer) (*Node, int64, error) {
        var pktEnc PktEnc
        _, err := xdr.Unmarshal(data, &pktEnc)
        if err != nil {
index e0765b3a7179c53be091cc421f4d4ff63c58d50a..5775e7327b18eb5fff91c3a276814528c97eae80 100644 (file)
@@ -81,7 +81,12 @@ func TestPktEncRead(t *testing.T) {
        if err != nil {
                panic(err)
        }
-       f := func(path string, pathSize uint8, data [1 << 16]byte, size, padSize uint16, junk []byte) bool {
+       f := func(
+               path string,
+               pathSize uint8,
+               data [1 << 16]byte,
+               size, padSize uint16,
+               junk []byte) bool {
                dataR := bytes.NewReader(data[:])
                var ct bytes.Buffer
                if len(path) > int(pathSize) {
index d2f329eae25554ff4b07329d93bfb0c63d6a3aee..957dec9793eef5d1c57f65c6a17fd50d855196da 100644 (file)
@@ -202,7 +202,8 @@ func (state *SPState) NotAlive() bool {
        if state.maxOnlineTime > 0 && state.started.Add(time.Duration(state.maxOnlineTime)*time.Second).Before(now) {
                return true
        }
-       return uint(now.Sub(state.RxLastSeen).Seconds()) >= state.onlineDeadline && uint(now.Sub(state.TxLastSeen).Seconds()) >= state.onlineDeadline
+       return uint(now.Sub(state.RxLastSeen).Seconds()) >= state.onlineDeadline &&
+               uint(now.Sub(state.TxLastSeen).Seconds()) >= state.onlineDeadline
 }
 
 func (state *SPState) dirUnlock() {
@@ -273,7 +274,13 @@ func (ctx *Ctx) infosOur(nodeId *NodeId, nice uint8, seen *map[[32]byte]uint8) [
        return payloadsSplit(payloads)
 }
 
-func (ctx *Ctx) StartI(conn net.Conn, nodeId *NodeId, nice uint8, xxOnly TRxTx, rxRate, txRate int, onlineDeadline, maxOnlineTime uint) (*SPState, error) {
+func (ctx *Ctx) StartI(
+       conn net.Conn,
+       nodeId *NodeId,
+       nice uint8,
+       xxOnly TRxTx,
+       rxRate, txRate int,
+       onlineDeadline, maxOnlineTime uint) (*SPState, error) {
        err := ctx.ensureRxDir(nodeId)
        if err != nil {
                return nil, err
@@ -491,7 +498,10 @@ func (ctx *Ctx) StartR(conn net.Conn, nice uint8, xxOnly TRxTx) (*SPState, error
        return &state, err
 }
 
-func (state *SPState) StartWorkers(conn net.Conn, infosPayloads [][]byte, payload []byte) error {
+func (state *SPState) StartWorkers(
+       conn net.Conn,
+       infosPayloads [][]byte,
+       payload []byte) error {
        sds := SDS{"node": state.Node.Id, "nice": strconv.Itoa(int(state.nice))}
        if len(infosPayloads) > 1 {
                go func() {
index 86d154b2aa310a36b454e87c36ab989312c80e44..fa49c169049c9c5882a852e5e99abc6a58834cff 100644 (file)
@@ -52,7 +52,10 @@ func newNotification(fromTo *FromToYAML, subject string) io.Reader {
        ))
 }
 
-func (ctx *Ctx) Toss(nodeId *NodeId, nice uint8, dryRun, doSeen, noFile, noFreq, noExec, noTrns bool) bool {
+func (ctx *Ctx) Toss(
+       nodeId *NodeId,
+       nice uint8,
+       dryRun, doSeen, noFile, noFreq, noExec, noTrns bool) bool {
        isBad := false
        for job := range ctx.Jobs(nodeId, TRx) {
                pktName := filepath.Base(job.Fd.Name())
index 43198138b6440907abf09668e31c0cff7fc4b649..0692ecaa66433128026799f3b80d609fc6a7d111 100644 (file)
@@ -36,7 +36,12 @@ import (
        "golang.org/x/crypto/blake2b"
 )
 
-func (ctx *Ctx) Tx(node *Node, pkt *Pkt, nice uint8, size, minSize int64, src io.Reader) (*Node, error) {
+func (ctx *Ctx) Tx(
+       node *Node,
+       pkt *Pkt,
+       nice uint8,
+       size, minSize int64,
+       src io.Reader) (*Node, error) {
        tmp, err := ctx.NewTmpFileWHash()
        if err != nil {
                return nil, err
@@ -180,7 +185,12 @@ func (ctx *Ctx) TxFile(node *Node, nice uint8, srcPath, dstPath string, minSize
        return err
 }
 
-func (ctx *Ctx) TxFileChunked(node *Node, nice uint8, srcPath, dstPath string, minSize int64, chunkSize int64) error {
+func (ctx *Ctx) TxFileChunked(
+       node *Node,
+       nice uint8,
+       srcPath, dstPath string,
+       minSize int64,
+       chunkSize int64) error {
        if dstPath == "" {
                if srcPath == "-" {
                        return errors.New("Must provide destination filename")
@@ -312,7 +322,11 @@ func (ctx *Ctx) TxFileChunked(node *Node, nice uint8, srcPath, dstPath string, m
        return err
 }
 
-func (ctx *Ctx) TxFreq(node *Node, nice, replyNice uint8, srcPath, dstPath string, minSize int64) error {
+func (ctx *Ctx) TxFreq(
+       node *Node,
+       nice, replyNice uint8,
+       srcPath, dstPath string,
+       minSize int64) error {
        dstPath = filepath.Clean(dstPath)
        if filepath.IsAbs(dstPath) {
                return errors.New("Relative destination path required")
@@ -345,7 +359,13 @@ func (ctx *Ctx) TxFreq(node *Node, nice, replyNice uint8, srcPath, dstPath strin
        return err
 }
 
-func (ctx *Ctx) TxExec(node *Node, nice, replyNice uint8, handle string, args []string, body []byte, minSize int64) error {
+func (ctx *Ctx) TxExec(
+       node *Node,
+       nice, replyNice uint8,
+       handle string,
+       args []string,
+       body []byte,
+       minSize int64) error {
        path := make([][]byte, 0, 1+len(args))
        path = append(path, []byte(handle))
        for _, arg := range args {