X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcypherpunks.ru%2Fnncp%2Fnode.go;h=1ea490309ff45b2146d3e6b22b0317d6b222508e;hb=b4c6e5230f3bec679ceb9ca4207da08f7e9c53aa;hp=05c41fda40646b48172ab45d5c9a0a9f208d253d;hpb=23cb8cf3f4539e314209ad9976c00696a9969161;p=nncp.git diff --git a/src/cypherpunks.ru/nncp/node.go b/src/cypherpunks.ru/nncp/node.go index 05c41fd..1ea4903 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" @@ -35,15 +37,24 @@ func (id NodeId) String() string { } type Node struct { - Name string - Id *NodeId - ExchPub *[32]byte - SignPub ed25519.PublicKey - NoisePub *[32]byte - Incoming *string - Freq *string - Via []*NodeId - Addrs map[string]string + Name string + Id *NodeId + ExchPub *[32]byte + SignPub ed25519.PublicKey + NoisePub *[32]byte + Sendmail []string + Incoming *string + Freq *string + FreqChunked int64 + FreqMinSize int64 + Via []*NodeId + Addrs map[string]string + OnlineDeadline uint + MaxOnlineTime uint + Calls []*Call + + Busy bool + sync.Mutex } type NodeOur struct { @@ -56,6 +67,15 @@ type NodeOur struct { NoisePrv *[32]byte } +type Call struct { + Cron *cronexpr.Expression + Nice uint8 + Xx TRxTx + Addr *string + OnlineDeadline uint + MaxOnlineTime uint +} + func NewNodeGenerate() (*NodeOur, error) { exchPub, exchPrv, err := box.GenerateKey(rand.Reader) if err != nil {