Documentation ¶
Index ¶
- func DefaultCreateNodeFunc(logger zerolog.Logger, host host.Host, pCache *p2pnode.ProtocolPeerCache, ...) p2p.LibP2PNode
- func DefaultLibP2PHost(address string, key fcrypto.PrivateKey, options ...config.Option) (host.Host, error)
- func DefaultMessageIDFunction(msg *pb.Message) string
- func DefaultPubsubOptions(maxPubSubMsgSize int) []pubsub.Option
- type CreateNodeFunc
- type LibP2PFactoryFunc
- type LibP2PNodeBuilder
- func (builder *LibP2PNodeBuilder) Build() (p2p.LibP2PNode, error)
- func (builder *LibP2PNodeBuilder) EnableGossipSubPeerScoring(provider module.IdentityProvider, ops ...scoring.PeerScoreParamsOption) NodeBuilder
- func (builder *LibP2PNodeBuilder) SetBasicResolver(br madns.BasicResolver) NodeBuilder
- func (builder *LibP2PNodeBuilder) SetConnectionGater(gater connmgr.ConnectionGater) NodeBuilder
- func (builder *LibP2PNodeBuilder) SetConnectionManager(manager connmgr.ConnManager) NodeBuilder
- func (builder *LibP2PNodeBuilder) SetCreateNode(f CreateNodeFunc) NodeBuilder
- func (builder *LibP2PNodeBuilder) SetPeerManagerOptions(connectionPruning bool, updateInterval time.Duration) NodeBuilder
- func (builder *LibP2PNodeBuilder) SetResourceManager(manager network.ResourceManager) NodeBuilder
- func (builder *LibP2PNodeBuilder) SetRoutingSystem(f func(context.Context, host.Host) (routing.Routing, error)) NodeBuilder
- func (builder *LibP2PNodeBuilder) SetSubscriptionFilter(filter pubsub.SubscriptionFilter) NodeBuilder
- type NodeBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultCreateNodeFunc ¶ added in v0.29.0
func DefaultCreateNodeFunc(logger zerolog.Logger, host host.Host, pCache *p2pnode.ProtocolPeerCache, uniMgr *unicast.Manager, peerManager *connection.PeerManager) 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 DefaultMessageIDFunction ¶
DefaultMessageIDFunction returns a default message ID function based on the message's data
func DefaultPubsubOptions ¶
Types ¶
type CreateNodeFunc ¶ added in v0.29.0
type CreateNodeFunc func(logger zerolog.Logger, host host.Host, pCache *p2pnode.ProtocolPeerCache, uniMgr *unicast.Manager, peerManager *connection.PeerManager) p2p.LibP2PNode
type LibP2PFactoryFunc ¶
type LibP2PFactoryFunc func() (p2p.LibP2PNode, error)
LibP2PFactoryFunc is a factory function type for generating libp2p Node instances.
func DefaultLibP2PNodeFactory ¶
func DefaultLibP2PNodeFactory( log zerolog.Logger, address string, flowKey fcrypto.PrivateKey, sporkId flow.Identifier, idProvider module.IdentityProvider, metrics module.NetworkMetrics, resolver madns.BasicResolver, peerScoringEnabled bool, role string, onInterceptPeerDialFilters, onInterceptSecuredFilters []p2p.PeerFilter, connectionPruning bool, updateInterval time.Duration, ) LibP2PFactoryFunc
DefaultLibP2PNodeFactory returns a LibP2PFactoryFunc which generates the libp2p host initialized with the default options for the host, the pubsub and the ping service.
type LibP2PNodeBuilder ¶
type LibP2PNodeBuilder struct {
// contains filtered or unexported fields
}
func NewNodeBuilder ¶
func NewNodeBuilder( logger zerolog.Logger, addr string, networkKey fcrypto.PrivateKey, sporkID flow.Identifier, ) *LibP2PNodeBuilder
func (*LibP2PNodeBuilder) Build ¶
func (builder *LibP2PNodeBuilder) Build() (p2p.LibP2PNode, error)
Build creates a new libp2p node using the configured options.
func (*LibP2PNodeBuilder) EnableGossipSubPeerScoring ¶
func (builder *LibP2PNodeBuilder) EnableGossipSubPeerScoring(provider module.IdentityProvider, ops ...scoring.PeerScoreParamsOption) NodeBuilder
EnableGossipSubPeerScoring sets builder.gossipSubPeerScoring to true.
func (*LibP2PNodeBuilder) SetBasicResolver ¶
func (builder *LibP2PNodeBuilder) SetBasicResolver(br madns.BasicResolver) NodeBuilder
SetBasicResolver sets the DNS resolver for the node.
func (*LibP2PNodeBuilder) SetConnectionGater ¶
func (builder *LibP2PNodeBuilder) SetConnectionGater(gater connmgr.ConnectionGater) NodeBuilder
SetConnectionGater sets the connection gater for the node.
func (*LibP2PNodeBuilder) SetConnectionManager ¶
func (builder *LibP2PNodeBuilder) SetConnectionManager(manager connmgr.ConnManager) NodeBuilder
SetConnectionManager sets the connection manager for the node.
func (*LibP2PNodeBuilder) SetCreateNode ¶ added in v0.29.0
func (builder *LibP2PNodeBuilder) SetCreateNode(f CreateNodeFunc) NodeBuilder
func (*LibP2PNodeBuilder) SetPeerManagerOptions ¶
func (builder *LibP2PNodeBuilder) SetPeerManagerOptions(connectionPruning bool, updateInterval time.Duration) NodeBuilder
SetPeerManagerOptions sets the peer manager options.
func (*LibP2PNodeBuilder) SetResourceManager ¶
func (builder *LibP2PNodeBuilder) SetResourceManager(manager network.ResourceManager) 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)) NodeBuilder
SetRoutingSystem sets the routing factory function.
func (*LibP2PNodeBuilder) SetSubscriptionFilter ¶
func (builder *LibP2PNodeBuilder) SetSubscriptionFilter(filter pubsub.SubscriptionFilter) NodeBuilder
SetSubscriptionFilter sets the pubsub subscription filter for the node.
type NodeBuilder ¶
type NodeBuilder interface { SetBasicResolver(madns.BasicResolver) NodeBuilder SetSubscriptionFilter(pubsub.SubscriptionFilter) NodeBuilder SetResourceManager(network.ResourceManager) NodeBuilder SetConnectionManager(connmgr.ConnManager) NodeBuilder SetConnectionGater(connmgr.ConnectionGater) NodeBuilder SetRoutingSystem(func(context.Context, host.Host) (routing.Routing, error)) NodeBuilder SetPeerManagerOptions(connectionPruning bool, updateInterval time.Duration) NodeBuilder EnableGossipSubPeerScoring(provider module.IdentityProvider, ops ...scoring.PeerScoreParamsOption) NodeBuilder SetCreateNode(CreateNodeFunc) NodeBuilder Build() (p2p.LibP2PNode, error) }
func DefaultNodeBuilder ¶ added in v0.29.0
func DefaultNodeBuilder(log zerolog.Logger, address string, flowKey fcrypto.PrivateKey, sporkId flow.Identifier, idProvider module.IdentityProvider, metrics module.NetworkMetrics, resolver madns.BasicResolver, role string, onInterceptPeerDialFilters, onInterceptSecuredFilters []p2p.PeerFilter, peerScoringEnabled bool, connectionPruning bool, updateInterval time.Duration, ) NodeBuilder
DefaultNodeBuilder returns a node builder.