Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHostWithConnectionManagement ¶
func NewHostWithConnectionManagement(ch ConnectableHost, sharder Sharder) (*hostWithConnectionManagement, error)
NewHostWithConnectionManagement returns a host wrapper able to decide if connection initiated to a peer will actually be kept or not
Types ¶
type ArgKadDht ¶
type ArgKadDht struct { Context context.Context Host ConnectableHost PeersRefreshInterval time.Duration ProtocolID string InitialPeersList []string BucketSize uint32 RoutingTableRefresh time.Duration KddSharder p2p.CommonSharder }
ArgKadDht represents the kad-dht config argument DTO
type ConnectableHost ¶
type ConnectableHost interface { host.Host ConnectToPeer(ctx context.Context, address string) error IsInterfaceNil() bool }
ConnectableHost is an enhanced Host interface that has the ability to connect to a string address
type ContinuousKadDhtDiscoverer ¶
type ContinuousKadDhtDiscoverer struct {
// contains filtered or unexported fields
}
ContinuousKadDhtDiscoverer is the kad-dht discovery type implementation This implementation does not support pausing and resuming of the discovery process
func NewContinuousKadDhtDiscoverer ¶
func NewContinuousKadDhtDiscoverer(arg ArgKadDht) (*ContinuousKadDhtDiscoverer, error)
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 (*ContinuousKadDhtDiscoverer) Bootstrap ¶
func (ckdd *ContinuousKadDhtDiscoverer) Bootstrap() error
Bootstrap will start the bootstrapping new peers process
func (*ContinuousKadDhtDiscoverer) IsInterfaceNil ¶
func (ckdd *ContinuousKadDhtDiscoverer) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*ContinuousKadDhtDiscoverer) Name ¶
func (ckdd *ContinuousKadDhtDiscoverer) Name() string
Name returns the name of the kad dht peer discovery implementation
func (*ContinuousKadDhtDiscoverer) ReconnectToNetwork ¶
func (ckdd *ContinuousKadDhtDiscoverer) ReconnectToNetwork() <-chan struct{}
ReconnectToNetwork will try to connect to one peer from the initial peer list
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() <-chan struct{}
ReconnectToNetwork returns an empty channel