Documentation
¶
Overview ¶
Package network handles P2P communication between nodes
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidConfig = fmt.Errorf("invalid network configuration")
ErrInvalidConfig indicates the network configuration is invalid
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Port is the port to listen on (0 for random)
Port int
// Peer is the multiaddr of a peer to connect to (optional)
Peer string
}
Config represents network configuration
type Node ¶
type Node interface {
// Host returns the libp2p host
Host() host.Host
// Connect connects to a peer
Connect(ctx context.Context, addr multiaddr.Multiaddr) error
// Peers returns the list of connected peers
Peers() []peer.ID
// Close closes the node
Close() error
}
Node represents a P2P network node
Click to show internal directories.
Click to hide internal directories.