X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcypherpunks.ru%2Fnncp%2Fnode.go;h=1e1b5bab3b3e96da17bd4aad8784f188707b348e;hb=919345b4dbaba2fc8f543efb8e0ec99330a775fc;hp=5edd5ead8554817565792bcb22a7c690d8560e85;hpb=1d5d42e15ebf3c8b1296554be10dae442bd462f7;p=nncp.git diff --git a/src/cypherpunks.ru/nncp/node.go b/src/cypherpunks.ru/nncp/node.go index 5edd5ea..1e1b5ba 100644 --- a/src/cypherpunks.ru/nncp/node.go +++ b/src/cypherpunks.ru/nncp/node.go @@ -21,8 +21,10 @@ package nncp import ( "crypto/rand" "errors" + "sync" "github.com/flynn/noise" + "github.com/gorhill/cronexpr" "golang.org/x/crypto/blake2b" "golang.org/x/crypto/ed25519" "golang.org/x/crypto/nacl/box" @@ -46,6 +48,10 @@ type Node struct { Via []*NodeId Addrs map[string]string OnlineDeadline int + Calls []*Call + + Busy bool + sync.Mutex } type NodeOur struct { @@ -58,6 +64,14 @@ type NodeOur struct { NoisePrv *[32]byte } +type Call struct { + Cron *cronexpr.Expression + Nice uint8 + Xx *TRxTx + Addr *string + OnlineDeadline int +} + func NewNodeGenerate() (*NodeOur, error) { exchPub, exchPrv, err := box.GenerateKey(rand.Reader) if err != nil {