Documentation
¶
Overview ¶
Package node maintains information about peers on the network and associated connection sessions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct { nonce.ID Addr string AddrPort *netip.AddrPort IdentityPub *pub.Key IdentityBytes pub.Bytes IdentityPrv *prv.Key PingCount int LastSeen time.Time Services ifc.Transport }
Node is a representation of a messaging counterparty. The netip.AddrPort can be nil for the case of a client node that is not in a direct open connection. For this reason all nodes are assigned an ID and will normally be handled by this except when the netip.AddrPort is known via the packet sender address.
func New ¶
func New(addr *netip.AddrPort, hdr *pub.Key, hdrPrv *prv.Key, tpt ifc.Transport) (n *Node, id nonce.ID)
New creates a new Node. netip.AddrPort is optional if the counterparty is not in direct connection.
func (*Node) ReceiveFrom ¶
ReceiveFrom returns the channel that receives messages for a given port.
type Nodes ¶
type Nodes []*Node
func (Nodes) DeleteByAddrPort ¶
DeleteByAddrPort deletes a node identified by a netip.AddrPort.
func (Nodes) DeleteByID ¶
DeleteByID deletes a node identified by an ID.
func (Nodes) FindByAddrPort ¶
FindByAddrPort searches for a Node by netip.AddrPort.