p2p

package
v0.2202.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2023 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Overview

Package p2p implements the worker committee gossip network.

Index

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

Flags has the configuration flags.

Functions

func DebugForceAllowUnroutableAddresses

func DebugForceAllowUnroutableAddresses()

DebugForceAllowUnroutableAddresses allows unroutable addresses.

func New

func New(identity *identity.Identity, consensus consensus.Backend) (api.Service, error)

New creates a new P2P node.

func NewNop added in v0.2202.0

func NewNop() api.Service

NewNop creates a new no-op P2P node.

Types

type PeerManager

type PeerManager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL