p2pbuilder

package
v0.32.11-verification-... Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: AGPL-3.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyInboundConnectionLimits added in v0.32.3

func ApplyInboundConnectionLimits(logger zerolog.Logger, concrete rcmgr.ConcreteLimitConfig, peerLimit int) rcmgr.ConcreteLimitConfig

ApplyInboundConnectionLimits applies the inbound connection limits to the concrete limit config. The concrete limit config is assumed coming from scaling the base limit config by the scaling factor. The inbound connection limit is applied if its value is greater than 0. Otherwise, the inbound connection limit is set by the concrete limit config. The inbound limits are assumed coming from the config file. Args:

logger: the logger to log the applied limits.
concrete: the concrete limit config.
peerLimit: the inbound connection limit from each remote peer.

Returns:

a copy of the concrete limit config with the inbound connection limits applied and overridden.

func ApplyInboundStreamLimits added in v0.32.3

func ApplyInboundStreamLimits(logger zerolog.Logger, concrete rcmgr.ConcreteLimitConfig, limit p2pconf.InboundStreamLimit) rcmgr.ConcreteLimitConfig

ApplyInboundStreamLimits applies the inbound stream limits to the concrete limit config. The concrete limit config is assumed coming from scaling the base limit config by the scaling factor. The inbound stream limits are applied to the concrete limit config if the concrete limit config is greater than the inbound stream limits. The inbound limits are assumed coming from the config file. Args:

logger: the logger to log the applied limits.
concrete: the concrete limit config.
limit: the inbound stream limits.

Returns:

a copy of the concrete limit config with the inbound stream limits applied and overridden.

func DefaultCreateNodeFunc added in v0.29.0

func DefaultCreateNodeFunc(
	logger zerolog.Logger,
	host host.Host,
	pCache p2p.ProtocolPeerCache,
	peerManager p2p.PeerManager,
	disallowListCacheCfg *p2p.DisallowListCacheConfig,
) p2p.LibP2PNode

DefaultCreateNodeFunc returns new libP2P node.

func DefaultLibP2PHost

func DefaultLibP2PHost(address string, key fcrypto.PrivateKey, options ...config.Option) (host.Host, error)

DefaultLibP2PHost returns a libp2p host initialized to listen on the given address and using the given private key and customized with options

func DefaultNodeBuilder added in v0.29.0

func DefaultNodeBuilder(
	logger zerolog.Logger,
	address string,
	networkingType flownet.NetworkingType,
	flowKey fcrypto.PrivateKey,
	sporkId flow.Identifier,
	idProvider module.IdentityProvider,
	metricsCfg *p2pconfig.MetricsConfig,
	resolver madns.BasicResolver,
	role string,
	connGaterCfg *p2pconfig.ConnectionGaterConfig,
	peerManagerCfg *p2pconfig.PeerManagerConfig,
	gossipCfg *p2pconf.GossipSubConfig,
	rpcInspectorCfg *p2pconf.GossipSubRPCInspectorsConfig,
	rCfg *p2pconf.ResourceManagerConfig,
	uniCfg *p2pconfig.UnicastConfig,
	connMgrConfig *netconf.ConnectionManagerConfig,
	disallowListCacheCfg *p2p.DisallowListCacheConfig,
	dhtSystemActivation DhtSystemActivation,
) (p2p.NodeBuilder, error)

DefaultNodeBuilder returns a node builder.

Types

type DhtSystemActivation added in v0.31.24

type DhtSystemActivation bool
const (
	DhtSystemEnabled  DhtSystemActivation = true
	DhtSystemDisabled DhtSystemActivation = false
)

type LibP2PNodeBuilder

type LibP2PNodeBuilder struct {
	// contains filtered or unexported fields
}

func NewNodeBuilder

func NewNodeBuilder(
	logger zerolog.Logger,
	metricsConfig *p2pconfig.MetricsConfig,
	networkingType flownet.NetworkingType,
	address string,
	networkKey fcrypto.PrivateKey,
	sporkId flow.Identifier,
	idProvider module.IdentityProvider,
	rCfg *p2pconf.ResourceManagerConfig,
	rpcInspectorCfg *p2pconf.GossipSubRPCInspectorsConfig,
	peerManagerConfig *p2pconfig.PeerManagerConfig,
	disallowListCacheCfg *p2p.DisallowListCacheConfig,
	rpcTracker p2p.RpcControlTracking,
	unicastConfig *p2pconfig.UnicastConfig,
) *LibP2PNodeBuilder

func (*LibP2PNodeBuilder) Build

func (builder *LibP2PNodeBuilder) Build() (p2p.LibP2PNode, error)

Build creates a new libp2p node using the configured options.

func (*LibP2PNodeBuilder) EnableGossipSubScoringWithOverride added in v0.32.0

func (builder *LibP2PNodeBuilder) EnableGossipSubScoringWithOverride(config *p2p.PeerScoringConfigOverride) p2p.NodeBuilder

EnableGossipSubScoringWithOverride enables peer scoring for the GossipSub pubsub system with the given override. Any existing peer scoring config attribute that is set in the override will override the default peer scoring config. Anything that is left to nil or zero value in the override will be ignored and the default value will be used. Note: it is not recommended to override the default peer scoring config in production unless you know what you are doing. Production Tip: use PeerScoringConfigNoOverride as the argument to this function to enable peer scoring without any override. Args: - PeerScoringConfigOverride: override for the peer scoring config- Recommended to use PeerScoringConfigNoOverride for production. Returns: none

func (*LibP2PNodeBuilder) OverrideDefaultRpcInspectorSuiteFactory added in v0.32.0

func (builder *LibP2PNodeBuilder) OverrideDefaultRpcInspectorSuiteFactory(factory p2p.GossipSubRpcInspectorSuiteFactoryFunc) p2p.NodeBuilder

func (*LibP2PNodeBuilder) SetBasicResolver

func (builder *LibP2PNodeBuilder) SetBasicResolver(br madns.BasicResolver) p2p.NodeBuilder

SetBasicResolver sets the DNS resolver for the node.

func (*LibP2PNodeBuilder) SetConnectionGater

func (builder *LibP2PNodeBuilder) SetConnectionGater(gater p2p.ConnectionGater) p2p.NodeBuilder

SetConnectionGater sets the connection gater for the node.

func (*LibP2PNodeBuilder) SetConnectionManager

func (builder *LibP2PNodeBuilder) SetConnectionManager(manager connmgr.ConnManager) p2p.NodeBuilder

SetConnectionManager sets the connection manager for the node.

func (*LibP2PNodeBuilder) SetCreateNode added in v0.29.0

func (builder *LibP2PNodeBuilder) SetCreateNode(f p2p.CreateNodeFunc) p2p.NodeBuilder

func (*LibP2PNodeBuilder) SetGossipSubFactory added in v0.29.0

func (*LibP2PNodeBuilder) SetGossipSubScoreTracerInterval added in v0.30.0

func (builder *LibP2PNodeBuilder) SetGossipSubScoreTracerInterval(interval time.Duration) p2p.NodeBuilder

func (*LibP2PNodeBuilder) SetGossipSubTracer added in v0.30.0

func (builder *LibP2PNodeBuilder) SetGossipSubTracer(tracer p2p.PubSubTracer) p2p.NodeBuilder

func (*LibP2PNodeBuilder) SetResourceManager

func (builder *LibP2PNodeBuilder) SetResourceManager(manager network.ResourceManager) p2p.NodeBuilder

SetResourceManager sets the resource manager for the node.

func (*LibP2PNodeBuilder) SetRoutingSystem

func (builder *LibP2PNodeBuilder) SetRoutingSystem(f func(context.Context, host.Host) (routing.Routing, error)) p2p.NodeBuilder

SetRoutingSystem sets the routing system factory function.

func (*LibP2PNodeBuilder) SetSubscriptionFilter

func (builder *LibP2PNodeBuilder) SetSubscriptionFilter(filter pubsub.SubscriptionFilter) p2p.NodeBuilder

SetSubscriptionFilter sets the pubsub subscription filter for the node.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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