Documentation ¶
Index ¶
- 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 LibP2PFactoryFunc
- type LibP2PNodeBuilder
- func (builder *LibP2PNodeBuilder) Build() (*p2pnode.Node, 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) 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 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 LibP2PFactoryFunc ¶
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, 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() (*p2pnode.Node, 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
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) SetPeerManagerOptions ¶
func (builder *LibP2PNodeBuilder) SetPeerManagerOptions(connectionPruning bool, updateInterval time.Duration) NodeBuilder
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(module.IdentityProvider, ...scoring.PeerScoreParamsOption) NodeBuilder Build() (*p2pnode.Node, error) }