discovery

package
v1.2.33-indexer1.1.25 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2021 License: GPL-3.0 Imports: 15 Imported by: 0

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

func NewOptimizedKadDhtDiscoverer added in v1.2.0

func NewOptimizedKadDhtDiscoverer(arg ArgKadDht) (*optimizedKadDhtDiscoverer, error)

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
}

ArgKadDht represents the kad-dht config argument DTO

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 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(ctx context.Context)

ReconnectToNetwork will try to connect to one peer from the initial peer list

type KadDhtHandler added in v1.2.0

type KadDhtHandler interface {
	Bootstrap(ctx context.Context) error
}

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

type Sharder

type Sharder interface {
	ComputeEvictionList(pidList []peer.ID) []peer.ID
	Has(pid peer.ID, list []peer.ID) bool
	SetSeeders(addresses []string)
	IsSeeder(pid core.PeerID) bool
	IsInterfaceNil() bool
}

Sharder defines the eviction computing process of unwanted peers

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL