Documentation ¶
Index ¶
- func ApplyResourceLimitOverride(logger zerolog.Logger, resourceScope p2pconf.ResourceScope, ...) rcmgr.ResourceLimits
- func BuildLibp2pResourceManagerLimits(logger zerolog.Logger, config *p2pconf.ResourceManagerConfig) (*rcmgr.ConcreteLimitConfig, error)
- func DefaultCreateNodeFunc(logger zerolog.Logger, host host.Host, pCache p2p.ProtocolPeerCache, ...) p2p.LibP2PNode
- func DefaultLibP2PHost(address string, key fcrypto.PrivateKey, options ...config.Option) (host.Host, error)
- func DefaultNodeBuilder(logger zerolog.Logger, address string, networkingType flownet.NetworkingType, ...) (p2p.NodeBuilder, error)
- type DhtSystemActivation
- type LibP2PNodeBuilder
- func (builder *LibP2PNodeBuilder) Build() (p2p.LibP2PNode, error)
- func (builder *LibP2PNodeBuilder) EnableGossipSubScoringWithOverride(config *p2p.PeerScoringConfigOverride) p2p.NodeBuilder
- func (builder *LibP2PNodeBuilder) OverrideDefaultRpcInspectorSuiteFactory(factory p2p.GossipSubRpcInspectorSuiteFactoryFunc) p2p.NodeBuilder
- func (builder *LibP2PNodeBuilder) SetBasicResolver(br madns.BasicResolver) p2p.NodeBuilder
- func (builder *LibP2PNodeBuilder) SetConnectionGater(gater p2p.ConnectionGater) p2p.NodeBuilder
- func (builder *LibP2PNodeBuilder) SetConnectionManager(manager connmgr.ConnManager) p2p.NodeBuilder
- func (builder *LibP2PNodeBuilder) SetCreateNode(f p2p.CreateNodeFunc) p2p.NodeBuilder
- func (builder *LibP2PNodeBuilder) SetGossipSubFactory(gf p2p.GossipSubFactoryFunc, cf p2p.GossipSubAdapterConfigFunc) p2p.NodeBuilder
- func (builder *LibP2PNodeBuilder) SetGossipSubScoreTracerInterval(interval time.Duration) p2p.NodeBuilder
- func (builder *LibP2PNodeBuilder) SetGossipSubTracer(tracer p2p.PubSubTracer) p2p.NodeBuilder
- func (builder *LibP2PNodeBuilder) SetResourceManager(manager network.ResourceManager) p2p.NodeBuilder
- func (builder *LibP2PNodeBuilder) SetRoutingSystem(f func(context.Context, host.Host) (routing.Routing, error)) p2p.NodeBuilder
- func (builder *LibP2PNodeBuilder) SetSubscriptionFilter(filter pubsub.SubscriptionFilter) p2p.NodeBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyResourceLimitOverride ¶
func ApplyResourceLimitOverride(logger zerolog.Logger, resourceScope p2pconf.ResourceScope, original rcmgr.ResourceLimits, override p2pconf.ResourceManagerOverrideLimit) rcmgr.ResourceLimits
ApplyResourceLimitOverride applies the override limit to the original limit. For any attribute that is set in the override limit, the original limit will be overridden, otherwise the original limit will be used. Args:
logger: logger to log the override limit. resourceScope: the scope of the resource, e.g., system, transient, protocol, peer, peer-protocol. original: the original limit. override: the override limit.
Returns:
the overridden limit.
func BuildLibp2pResourceManagerLimits ¶
func BuildLibp2pResourceManagerLimits(logger zerolog.Logger, config *p2pconf.ResourceManagerConfig) (*rcmgr.ConcreteLimitConfig, error)
BuildLibp2pResourceManagerLimits builds the resource manager limits for the libp2p node. Args:
logger: logger to log the resource manager limits. config: the resource manager configuration.
Returns:
- the resource manager limits.
- any error encountered, all returned errors are irrecoverable (we cannot continue without the resource manager limits).
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, 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, scoringRegistryConfig p2pconf.GossipSubScoringRegistryConfig, rCfg *p2pconf.ResourceManagerConfig, gossipCfg *p2pconf.GossipSubConfig, 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 (builder *LibP2PNodeBuilder) SetGossipSubFactory(gf p2p.GossipSubFactoryFunc, cf p2p.GossipSubAdapterConfigFunc) p2p.NodeBuilder
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.