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
*identity.Peer
PingCount int
LastSeen time.Time
*traffic.Payments
service.Services
}
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, or for the special node in a client. 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, idPub *pub.Key, idPrv *prv.Key, tpt types.Transport) (n *Node, id nonce.ID)
New creates a new Node. netip.AddrPort is optional if the counterparty is not in direct connection. Also, the idPrv node private key can be nil, as only the node embedded in a client and not the peer node list has one available.
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.