Documentation ¶
Index ¶
- func NewContinuousKadDhtDiscoverer(arg ArgKadDht) (*continuousKadDhtDiscoverer, error)
- func NewHostWithConnectionManagement(args ArgsHostWithConnectionManagement) (*hostWithConnectionManagement, error)
- func NewOptimizedKadDhtDiscoverer(arg ArgKadDht) (*optimizedKadDhtDiscoverer, error)
- type ArgKadDht
- type ArgsHostWithConnectionManagement
- type ConnectableHost
- type KadDhtHandler
- type NilDiscoverer
- type Sharder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewContinuousKadDhtDiscoverer ¶
NewContinuousKadDhtDiscoverer creates a new kad-dht discovery type implementation initialPeersList can be nil or empty, no initial connection will be attempted, a warning message will appear
func NewHostWithConnectionManagement ¶
func NewHostWithConnectionManagement(args ArgsHostWithConnectionManagement) (*hostWithConnectionManagement, error)
NewHostWithConnectionManagement returns a host wrapper able to decide if connection initiated to a peer will actually be kept or not
func NewOptimizedKadDhtDiscoverer ¶
NewOptimizedKadDhtDiscoverer creates an optimized kad-dht discovery type implementation initialPeersList can be nil or empty, no initial connection will be attempted, a warning message will appear This implementation uses a single process loop function able to carry multiple tasks synchronously
Types ¶
type ArgKadDht ¶
type ArgKadDht struct { Context context.Context Host ConnectableHost PeersRefreshInterval time.Duration SeedersReconnectionInterval time.Duration ProtocolID string InitialPeersList []string BucketSize uint32 RoutingTableRefresh time.Duration KddSharder p2p.Sharder ConnectionWatcher p2p.ConnectionsWatcher NetworkType p2p.NetworkType Logger p2p.Logger }
ArgKadDht represents the kad-dht config argument DTO
type ArgsHostWithConnectionManagement ¶
type ArgsHostWithConnectionManagement struct { ConnectableHost ConnectableHost Sharder Sharder ConnectionsWatcher p2p.ConnectionsWatcher }
ArgsHostWithConnectionManagement is the argument DTO used in the NewHostWithConnectionManagement function
type ConnectableHost ¶
type ConnectableHost interface { host.Host ConnectToPeer(ctx context.Context, address string) error AddressToPeerInfo(address string) (*peer.AddrInfo, error) IsInterfaceNil() bool }
ConnectableHost is an enhanced Host interface that has the ability to connect to a string address
type KadDhtHandler ¶
KadDhtHandler defines the behavior of a component that can find new peers in a p2p network through kad dht mechanism
type NilDiscoverer ¶
type NilDiscoverer struct { }
NilDiscoverer is the non-functional peer discoverer aimed to be used when peer discovery options are all disabled
func NewNilDiscoverer ¶
func NewNilDiscoverer() *NilDiscoverer
NewNilDiscoverer creates a new NullDiscoverer implementation
func (*NilDiscoverer) Bootstrap ¶
func (nd *NilDiscoverer) Bootstrap() error
Bootstrap will return nil. There is no implementation.
func (*NilDiscoverer) IsInterfaceNil ¶
func (nd *NilDiscoverer) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*NilDiscoverer) Name ¶
func (nd *NilDiscoverer) Name() string
Name returns a message which says no peer discovery mechanism is used
func (*NilDiscoverer) ReconnectToNetwork ¶
func (nd *NilDiscoverer) ReconnectToNetwork(_ context.Context)
ReconnectToNetwork does nothing