/*
NNCP -- Node to Node copy, utilities for store-and-forward data exchange
-Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2016-2021 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
"crypto/rand"
"errors"
"sync"
+ "time"
"github.com/flynn/noise"
"golang.org/x/crypto/blake2b"
type NodeId [blake2b.Size256]byte
func (id NodeId) String() string {
- return ToBase32(id[:])
+ return Base32Codec.EncodeToString(id[:])
}
type Node struct {
NoisePub *[32]byte
Exec map[string][]string
Incoming *string
- Freq *string
+ FreqPath *string
FreqChunked int64
FreqMinSize int64
+ FreqMaxSize int64
Via []*NodeId
Addrs map[string]string
RxRate int
TxRate int
- OnlineDeadline uint
- MaxOnlineTime uint
+ OnlineDeadline time.Duration
+ MaxOnlineTime time.Duration
Calls []*Call
Busy bool
func (nodeOur *NodeOur) Their() *Node {
return &Node{
- Name: "self",
- Id: nodeOur.Id,
- ExchPub: nodeOur.ExchPub,
- SignPub: nodeOur.SignPub,
+ Name: "self",
+ Id: nodeOur.Id,
+ ExchPub: nodeOur.ExchPub,
+ SignPub: nodeOur.SignPub,
+ FreqChunked: MaxFileSize,
+ FreqMaxSize: MaxFileSize,
}
}
func NodeIdFromString(raw string) (*NodeId, error) {
- decoded, err := FromBase32(raw)
+ decoded, err := Base32Codec.DecodeString(raw)
if err != nil {
return nil, err
}