Documentation ¶
Index ¶
- Constants
- type DiscV5
- type Discovery
- type Multiplexer
- func (m Multiplexer) Discover(topic string, period <-chan time.Duration, found chan<- *discv5.Node, ...) error
- func (m Multiplexer) Register(topic string, stop chan struct{}) error
- func (m Multiplexer) Running() (rst bool)
- func (m Multiplexer) Start() (err error)
- func (m Multiplexer) Stop() (err error)
Constants ¶
const (
// EthereumV5 is kademlia-based discovery from go-ethereum repository.
EthereumV5 = "ethv5"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiscV5 ¶
type DiscV5 struct {
// contains filtered or unexported fields
}
DiscV5 is a facade for ethereum discv5 implementation.
func (*DiscV5) Discover ¶
func (d *DiscV5) Discover(topic string, period <-chan time.Duration, found chan<- *discv5.Node, lookup chan<- bool) error
Discover creates search request in v5 server. Results will be published to found channel. It will block until period is closed.
func (*DiscV5) Register ¶
Register creates a register request in v5 server. It will block until stop is closed.
type Discovery ¶
type Discovery interface { Running() bool Start() error Stop() error Register(topic string, stop chan struct{}) error Discover(topic string, period <-chan time.Duration, found chan<- *discv5.Node, lookup chan<- bool) error }
Discovery is an abstract interface for using different discovery providers.
type Multiplexer ¶
type Multiplexer struct {
// contains filtered or unexported fields
}
Multiplexer allows to use multiple discoveries behind single Discovery interface.
func NewMultiplexer ¶
func NewMultiplexer(discoveries []Discovery) Multiplexer
NewMultiplexer creates Multiplexer instance.
func (Multiplexer) Discover ¶
func (m Multiplexer) Discover(topic string, period <-chan time.Duration, found chan<- *discv5.Node, lookup chan<- bool) error
Discover shares topic and channles for receiving results. And multiplexer periods that are sent to period channel.
func (Multiplexer) Register ¶
func (m Multiplexer) Register(topic string, stop chan struct{}) error
Register passed topic and stop channel to every discovery and waits till it will return.
func (Multiplexer) Running ¶
func (m Multiplexer) Running() (rst bool)
Running should return true if at least one discovery is running
func (Multiplexer) Start ¶
func (m Multiplexer) Start() (err error)
Start every discovery and stop every started in case if at least one fails.