Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Discovery ¶
type Discovery interface { AddNode(string) bool // Add an address to the discovery list RemoveNode(string) bool // Remove an address from the discovery list GetAllNodes() []string // Return all addresses this peer maintains GetRandomNodes(n int) []string // Return n random addresses for this peer to connect to FindNode(string) bool // Find a node in the discovery list }
Discovery is the interface that consolidates bootstrap peer membership selection and validating peer selection for non-validating peers
type DiscoveryImpl ¶
DiscoveryImpl is an implementation of Discovery
func NewDiscoveryImpl ¶
func NewDiscoveryImpl() *DiscoveryImpl
NewDiscoveryImpl is a constructor of a Discovery implementation
func (*DiscoveryImpl) AddNode ¶
func (di *DiscoveryImpl) AddNode(address string) bool
AddNode adds an address to the discovery list
func (*DiscoveryImpl) FindNode ¶
func (di *DiscoveryImpl) FindNode(address string) bool
FindNode returns true if its address is stored in the discovery list
func (*DiscoveryImpl) GetAllNodes ¶
func (di *DiscoveryImpl) GetAllNodes() []string
GetAllNodes returns an array of all addresses saved in the discovery list
func (*DiscoveryImpl) GetRandomNodes ¶
func (di *DiscoveryImpl) GetRandomNodes(n int) []string
GetRandomNodes returns n random nodes
func (*DiscoveryImpl) RemoveNode ¶
func (di *DiscoveryImpl) RemoveNode(address string) bool
RemoveNode removes an address from the discovery list
Click to show internal directories.
Click to hide internal directories.