]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/cypherpunks.ru/nncp/node.go
nncp-caller command
[nncp.git] / src / cypherpunks.ru / nncp / node.go
index 5edd5ead8554817565792bcb22a7c690d8560e85..1e1b5bab3b3e96da17bd4aad8784f188707b348e 100644 (file)
@@ -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 {