Documentation
¶
Index ¶
- func NewHostDecorator(h host.Host, ctx context.Context, cps uint32, timeout time.Duration) (*hostDecorator, error)
- type KadDhtDiscoverer
- func (kdd *KadDhtDiscoverer) ApplyContext(ctxProvider p2p.ContextProvider) error
- func (kdd *KadDhtDiscoverer) Bootstrap() error
- func (kdd *KadDhtDiscoverer) IsDiscoveryPaused() bool
- func (kdd *KadDhtDiscoverer) IsInterfaceNil() bool
- func (kdd *KadDhtDiscoverer) KickWatchdog() error
- func (kdd *KadDhtDiscoverer) Name() string
- func (kdd *KadDhtDiscoverer) Pause()
- func (kdd *KadDhtDiscoverer) ReconnectToNetwork() <-chan struct{}
- func (kdd *KadDhtDiscoverer) Resume()
- func (kdd *KadDhtDiscoverer) StartWatchdog(timeout time.Duration) error
- func (kdd *KadDhtDiscoverer) StopWatchdog() error
- func (kdd *KadDhtDiscoverer) UpdateRandezVous(s string) error
- type NullDiscoverer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHostDecorator ¶
func NewHostDecorator(h host.Host, ctx context.Context, cps uint32, timeout time.Duration) (*hostDecorator, error)
NewHostDecorator creates a new decorator around an existing host (h) that will only allow cps connections per second and drop the connection request upon timeout expiration
Types ¶
type KadDhtDiscoverer ¶
type KadDhtDiscoverer struct {
// contains filtered or unexported fields
}
KadDhtDiscoverer is the kad-dht discovery type implementation
func NewKadDhtPeerDiscoverer ¶
func NewKadDhtPeerDiscoverer( refreshInterval time.Duration, randezVous string, initialPeersList []string) *KadDhtDiscoverer
NewKadDhtPeerDiscoverer 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 (*KadDhtDiscoverer) ApplyContext ¶ added in v1.0.3
func (kdd *KadDhtDiscoverer) ApplyContext(ctxProvider p2p.ContextProvider) error
ApplyContext sets the context in which this discoverer is to be run
func (*KadDhtDiscoverer) Bootstrap ¶
func (kdd *KadDhtDiscoverer) Bootstrap() error
Bootstrap will start the bootstrapping new peers process
func (*KadDhtDiscoverer) IsDiscoveryPaused ¶
func (kdd *KadDhtDiscoverer) IsDiscoveryPaused() bool
IsDiscoveryPaused will return true if the discoverer is initiating connections
func (*KadDhtDiscoverer) IsInterfaceNil ¶
func (kdd *KadDhtDiscoverer) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*KadDhtDiscoverer) KickWatchdog ¶
func (kdd *KadDhtDiscoverer) KickWatchdog() error
KickWatchdog extends the discovery resume timeout
func (*KadDhtDiscoverer) Name ¶
func (kdd *KadDhtDiscoverer) Name() string
Name returns the name of the kad dht peer discovery implementation
func (*KadDhtDiscoverer) Pause ¶
func (kdd *KadDhtDiscoverer) Pause()
Pause will suspend the discovery process
func (*KadDhtDiscoverer) ReconnectToNetwork ¶
func (kdd *KadDhtDiscoverer) ReconnectToNetwork() <-chan struct{}
ReconnectToNetwork will try to connect to one peer from the initial peer list
func (*KadDhtDiscoverer) Resume ¶
func (kdd *KadDhtDiscoverer) Resume()
Resume will resume the discovery process
func (*KadDhtDiscoverer) StartWatchdog ¶
func (kdd *KadDhtDiscoverer) StartWatchdog(timeout time.Duration) error
StartWatchdog start the watchdog
func (*KadDhtDiscoverer) StopWatchdog ¶
func (kdd *KadDhtDiscoverer) StopWatchdog() error
StopWatchdog stops the discovery watchdog
func (*KadDhtDiscoverer) UpdateRandezVous ¶
func (kdd *KadDhtDiscoverer) UpdateRandezVous(s string) error
UpdateRandezVous change the randezVous string, and restart the discovery with the new protocols
type NullDiscoverer ¶ added in v1.0.3
type NullDiscoverer struct { }
NullDiscoverer is the non-functional peer discoverer aimed to be used when peer discovery options are all disabled
func NewNullDiscoverer ¶ added in v1.0.3
func NewNullDiscoverer() *NullDiscoverer
NewNullDiscoverer creates a new NullDiscoverer implementation
func (*NullDiscoverer) ApplyContext ¶ added in v1.0.3
func (nd *NullDiscoverer) ApplyContext(_ p2p.ContextProvider) error
ApplyContext is an empty func as the context is not required
func (*NullDiscoverer) Bootstrap ¶ added in v1.0.3
func (nd *NullDiscoverer) Bootstrap() error
Bootstrap will return nil. There is no implementation.
func (*NullDiscoverer) IsInterfaceNil ¶ added in v1.0.16
func (nd *NullDiscoverer) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*NullDiscoverer) Name ¶ added in v1.0.3
func (nd *NullDiscoverer) Name() string
Name returns a message which says no peer discovery mechanism is used