/*
-NNCP -- Node-to-Node CoPy
-Copyright (C) 2016-2017 Sergey Matveev <stargrave@stargrave.org>
+NNCP -- Node to Node copy, utilities for store-and-forward data exchange
+Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
import (
"crypto/rand"
"errors"
+ "sync"
"github.com/flynn/noise"
"golang.org/x/crypto/blake2b"
}
type Node struct {
- Name string
- Id *NodeId
- ExchPub *[32]byte
- SignPub ed25519.PublicKey
- NoisePub *[32]byte
- Incoming *string
- Freq *string
- Via []*NodeId
+ Name string
+ Id *NodeId
+ ExchPub *[32]byte
+ SignPub ed25519.PublicKey
+ NoisePub *[32]byte
+ Exec map[string][]string
+ Incoming *string
+ Freq *string
+ FreqChunked int64
+ FreqMinSize int64
+ Via []*NodeId
+ Addrs map[string]string
+ RxRate int
+ TxRate int
+ OnlineDeadline uint
+ MaxOnlineTime uint
+ Calls []*Call
+
+ Busy bool
+ sync.Mutex
}
type NodeOur struct {
if err != nil {
return nil, err
}
- noiseKey := noise.DH25519.GenerateKeypair(rand.Reader)
+ noiseKey, err := noise.DH25519.GenerateKeypair(rand.Reader)
+ if err != nil {
+ return nil, err
+ }
noisePub := new([32]byte)
noisePrv := new([32]byte)
copy(noisePrv[:], noiseKey.Private)