]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/cypherpunks.ru/nncp/node.go
Simple rate limiter
[nncp.git] / src / cypherpunks.ru / nncp / node.go
index f1fb79ff5bdf8df4b7bca8f44bdc1eb08e3b4802..b6cdcc65f9b09f08d55530c71d8e4f0922c61f16 100644 (file)
@@ -24,7 +24,6 @@ import (
        "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"
@@ -49,6 +48,8 @@ type Node struct {
        FreqMinSize    int64
        Via            []*NodeId
        Addrs          map[string]string
+       RxRate         int
+       TxRate         int
        OnlineDeadline uint
        MaxOnlineTime  uint
        Calls          []*Call
@@ -67,15 +68,6 @@ 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 {