github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/network/p2p/builder/config/config.go (about) 1 package p2pbuilderconfig 2 3 import ( 4 "time" 5 6 "github.com/onflow/flow-go/network/netconf" 7 "github.com/onflow/flow-go/network/p2p" 8 ) 9 10 // UnicastConfig configuration parameters for the unicast protocol. 11 type UnicastConfig struct { 12 netconf.Unicast 13 14 // RateLimiterDistributor distributor that distributes notifications whenever a peer is rate limited to all consumers. 15 RateLimiterDistributor p2p.UnicastRateLimiterDistributor 16 } 17 18 // ConnectionGaterConfig configuration parameters for the connection gater. 19 type ConnectionGaterConfig struct { 20 // InterceptPeerDialFilters list of peer filters used to filter peers on outgoing connections in the InterceptPeerDial callback. 21 InterceptPeerDialFilters []p2p.PeerFilter 22 // InterceptSecuredFilters list of peer filters used to filter peers and accept or reject inbound connections in InterceptSecured callback. 23 InterceptSecuredFilters []p2p.PeerFilter 24 } 25 26 // PeerManagerConfig configuration parameters for the peer manager. 27 type PeerManagerConfig struct { 28 // ConnectionPruning enables connection pruning in the connection manager. 29 ConnectionPruning bool 30 // UpdateInterval interval used by the libp2p node peer manager component to periodically request peer updates. 31 UpdateInterval time.Duration 32 // ConnectorFactory is a factory function to create a new connector. 33 ConnectorFactory p2p.ConnectorFactory 34 } 35 36 // PeerManagerDisableConfig returns a configuration that disables the peer manager. 37 func PeerManagerDisableConfig() *PeerManagerConfig { 38 return &PeerManagerConfig{ 39 ConnectionPruning: false, 40 UpdateInterval: 0, 41 ConnectorFactory: nil, 42 } 43 }