Documentation ¶
Index ¶
- Constants
- type Config
- type Discovery
- func (d *Discovery) Block(ID NodeID, IP net.IP)
- func (d *Discovery) HandleMsg(res *packet)
- func (d *Discovery) Lookup(id NodeID) []*Node
- func (d *Discovery) Mark(id NodeID, lifetime int64)
- func (d *Discovery) Need(n uint)
- func (d *Discovery) Nodes() []*Node
- func (d *Discovery) RandomNodes(result []*Node) int
- func (d *Discovery) RefreshTable()
- func (d *Discovery) Resolve(id NodeID) *Node
- func (d *Discovery) Start() (err error)
- func (d *Discovery) Stop()
- func (d *Discovery) SubNodes(ch chan<- *Node)
- func (d *Discovery) UnSubNodes(ch chan<- *Node)
- type Exception
- type FindNode
- type Message
- type Neighbors
- type Node
- type NodeID
- type Ping
- type Pong
Constants ¶
View Source
const K = 16
View Source
const N = 17
View Source
const NodeURLScheme = "vnode"
@section NodeURL
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Priv ed25519.PrivateKey DBPath string BootNodes []*Node Addr *net.UDPAddr Self *Node NetID network.ID }
@section Discovery
type Discovery ¶
type Discovery struct {
// contains filtered or unexported fields
}
type Exception ¶
type Exception struct {
Code eCode
}
type FindNode ¶
@message findnode
type Message ¶
type Message interface { String() string // contains filtered or unexported methods }
type Neighbors ¶
@message neighbors
type Node ¶
type Node struct { ID NodeID IP net.IP UDP uint16 TCP uint16 Net network.ID // contains filtered or unexported fields }
func (*Node) String ¶
marshal node to url-like string which looks like: vnode://<hex node id> vnode://<hex node id>@<ip>:<udpPort>#<tcpPort>
type NodeID ¶
type NodeID [32]byte
var ZERO_NODE_ID NodeID
func Priv2NodeID ¶
func Priv2NodeID(priv ed25519.PrivateKey) (NodeID, error)
type Ping ¶
message Ping
Click to show internal directories.
Click to hide internal directories.