Documentation
¶
Index ¶
- Constants
- type Config
- type Discovery
- func (d *Discovery) AdvertisedAddress() ma.Multiaddr
- func (d *Discovery) Bootstrap(ctx context.Context) error
- func (d *Discovery) CheckBook(ctx context.Context)
- func (d *Discovery) CheckPeers(ctx context.Context)
- func (d *Discovery) GetAddresses() []*addressbook.AddrInfo
- func (d *Discovery) GetRandomPeers(n int) []*addressbook.AddrInfo
- func (d *Discovery) Stop()
- type PeerExchangeConfig
Constants ¶
View Source
const (
// BootNodeTag is the tag used to identify boot nodes in connectionManager.
BootNodeTag = "bootnode"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Bootnodes []string DataDir string AdvertiseAddress string // Address to advertise to a peers. CheckInterval time.Duration // Interval to check for dead|alive peers in the book. CheckTimeout time.Duration // Timeout to connect while node check for dead|alive peers in the book. CheckPeersNumber int // Number of peers to check for dead|alive peers in the book. CheckPeersUsedBefore time.Duration // Time to wait before checking for dead|alive peers in the book. PeerExchange PeerExchangeConfig // Configuration for Peer Exchange protocol }
Config for Discovery.
type Discovery ¶
type Discovery struct {
// contains filtered or unexported fields
}
Discovery is struct that holds the protocol components, the protocol definition, the addr book data structure and more.
func (*Discovery) AdvertisedAddress ¶
AdvertisedAddress returns advertised address.
func (*Discovery) Bootstrap ¶
Bootstrap runs a refresh and tries to get a minimum number of nodes in the addrBook.
func (*Discovery) CheckPeers ¶
CheckPeers periodically checks the book for dead|alive peers.
func (*Discovery) GetAddresses ¶
func (d *Discovery) GetAddresses() []*addressbook.AddrInfo
GetAddresses returns all addresses of the node.
func (*Discovery) GetRandomPeers ¶
func (d *Discovery) GetRandomPeers(n int) []*addressbook.AddrInfo
GetRandomPeers get random N peers from provided peers list. peer should satisfy the following conditions: - peer is not a bootnode - peer is not a connected one - peer was attempted to connect X time in ago (defined in config).
type PeerExchangeConfig ¶
type PeerExchangeConfig struct {
// contains filtered or unexported fields
}
Peer Exchange protocol configuration.
func DefaultPeerExchangeConfig ¶
func DefaultPeerExchangeConfig() PeerExchangeConfig
Click to show internal directories.
Click to hide internal directories.