Documentation ¶
Overview ¶
Package node is a specification for the in-memory metadata related to an indra network peer.
This structure aggregates the address, identity keys, relay rate, services and payments channel for the peer.
Index ¶
- Constants
- type Node
- func (n *Node) AddService(s *services.Service) (e error)
- func (n *Node) DeleteService(port uint16)
- func (n *Node) FindService(port uint16) (svc *services.Service)
- func (n *Node) PickAddress(p protocols.NetworkProtocols) (ma multiaddr.Multiaddr)
- func (n *Node) ReceiveFrom(port uint16) (b <-chan slice.Bytes)
- func (n *Node) SendTo(port uint16, b slice.Bytes) (e error)
Constants ¶
View Source
const (
// PaymentChanBuffers is the default number of buffers used in a payment channel.
PaymentChanBuffers = 8
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct { // ID is a unique identifier used internally for references. ID nonce.ID // Mutex to stop concurrent read/write. *sync.Mutex // Addresses is the network addresses a node is listening to. // // These can be multiple, but for reasons of complexity, they are filtered by the available protocols for the session manager, ie ip4 always, ip6 sometimes. Addresses []*netip.AddrPort // Identity is the crypto.Keys identifying the node on the Indra network. Identity *crypto.Keys // RelayRate is the base relay price mSAT/Mb. RelayRate uint32 // Services offered by this peer. Services services.Services // Load is the current level of utilisation of the node's resources. Load byte // PayChan is the channel that payments to this node are sent/received on (internal/external node). payments.PayChan // Transport is the way to contact the node. Sending messages on this channel go // to the dispatcher to be segmented and delivered, or conversely assembled and // received. Transport tpt.Transport }
Node is a representation of a messaging counterparty.
func NewNode ¶
func NewNode(addr []*netip.AddrPort, keys *crypto.Keys, tpt tpt.Transport, relayRate uint32) (n *Node, id nonce.ID)
NewNode creates a new Node. The transport should be from either dialing out or a peer dialing in and the self model does not need to do this.
func (*Node) AddService ¶
AddService adds a service to a Node.
func (*Node) DeleteService ¶
DeleteService removes a service from a Node.
func (*Node) FindService ¶
FindService searches for a local service with a given port number.
func (*Node) PickAddress ¶ added in v0.1.19
func (n *Node) PickAddress(p protocols.NetworkProtocols) (ma multiaddr.Multiaddr)
func (*Node) ReceiveFrom ¶
ReceiveFrom returns the channel that receives messages for a given port.
Click to show internal directories.
Click to hide internal directories.