Documentation ¶
Overview ¶
Package p2p implements the worker committee gossip network.
Index ¶
- Constants
- Variables
- func DebugForceAllowUnroutableAddresses()
- func New(identity *identity.Identity, consensus consensus.Backend) (api.Service, error)
- func NewNop() api.Service
- type PeerManager
- func (mgr *PeerManager) Initialized() <-chan struct{}
- func (mgr *PeerManager) KnownPeers() []core.PeerID
- func (mgr *PeerManager) SetNodeImportance(kind api.ImportanceKind, runtimeID common.Namespace, ...)
- func (mgr *PeerManager) SetNodes(nodes []*node.Node)
- func (mgr *PeerManager) UpdateNode(node *node.Node) error
Constants ¶
View Source
const ( // CfgP2pPort configures the P2P port. CfgP2pPort = "worker.p2p.port" // CfgP2PPeerOutboundQueueSize sets the libp2p gossipsub buffer size for outbound messages. CfgP2PPeerOutboundQueueSize = "worker.p2p.peer_outbound_queue_size" // CfgP2PValidateQueueSize sets the libp2p gossipsub buffer size of the validate queue. CfgP2PValidateQueueSize = "worker.p2p.validate_queue_size" // CfgP2PValidateConcurrency sets the libp2p gossipsub per topic validator concurrency limit. // Note: this is a per-topic concurrency limit. We use one topic per runtime. CfgP2PValidateConcurrency = "worker.p2p.validate_concurrency" // CfgP2PValidateThrottle sets the libp2p gossipsub validator concurrency limit. // Note: this is a global (across all topics) validator concurrency limit. CfgP2PValidateThrottle = "worker.p2p.validate_throttle" // CfgP2PConnectednessLowWater sets the ratio of connected to unconnected peers at which // the peer manager will try to reconnect to disconnected nodes. CfgP2PConnectednessLowWater = "worker.p2p.connectedness_low_water" // CfgP2PMaxNumPeers is the maximum number of peers. CfgP2PMaxNumPeers = "worker.p2p.max_num_peers" // CfgP2PPeerGracePeriod is the peer grace period. CfgP2PPeerGracePeriod = "worker.p2p.peer_grace_period" // CfgP2PBlockedPeerIPs is a list of blocked peer IP addresses. CfgP2PBlockedPeerIPs = "worker.p2p.blocked_peers" // CfgP2PPersistentPeers is a list of persistent peer node addresses in format P2Ppubkey@IP:port. CfgP2PPersistentPeers = "worker.p2p.persistent_peers" )
Variables ¶
View Source
var Flags = flag.NewFlagSet("", flag.ContinueOnError)
Flags has the configuration flags.
Functions ¶
func DebugForceAllowUnroutableAddresses ¶
func DebugForceAllowUnroutableAddresses()
DebugForceAllowUnroutableAddresses allows unroutable addresses.
Types ¶
type PeerManager ¶
PeerManager handles managing peers in the gossipsub network.
func (*PeerManager) Initialized ¶ added in v0.2102.0
func (mgr *PeerManager) Initialized() <-chan struct{}
Initialized returns a channel that will be closed once the manager is initialized and has received the first node refresh event.
func (*PeerManager) KnownPeers ¶ added in v0.2102.0
func (mgr *PeerManager) KnownPeers() []core.PeerID
KnownPeers returns a list of currently known peer IDs.
func (*PeerManager) SetNodeImportance ¶ added in v0.2200.0
func (mgr *PeerManager) SetNodeImportance(kind api.ImportanceKind, runtimeID common.Namespace, p2pIDs map[signature.PublicKey]bool)
func (*PeerManager) SetNodes ¶
func (mgr *PeerManager) SetNodes(nodes []*node.Node)
SetNodes sets the membership of the gossipsub network.
func (*PeerManager) UpdateNode ¶
func (mgr *PeerManager) UpdateNode(node *node.Node) error
UpdateNode upserts a node into the gossipsub network.
Directories ¶
Path | Synopsis |
---|---|
Package api implements the P2P API.
|
Package api implements the P2P API. |
Package error exists only to break an import loop.
|
Package error exists only to break an import loop. |
Package rpc provides tools for building simple RPC protocols via libp2p.
|
Package rpc provides tools for building simple RPC protocols via libp2p. |
Click to show internal directories.
Click to hide internal directories.