Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Peers)
Option to modify peers instance.
func WithNodeStatesReporter ¶
func WithNodeStatesReporter(f func()) Option
WithNodeStatesReporter sets callback to report node status. Callback is invoked after new peer joins or disconnects.
type PeerSubscriptionProvider ¶
type PeerSubscriptionProvider interface {
SubscribePeerEvents() (conn, disc chan p2pcrypto.PublicKey)
}
PeerSubscriptionProvider is the interface that provides us with peer events channels.
type Peers ¶
type Peers struct {
// contains filtered or unexported fields
}
Peers is used by protocols to manage available peers.
func Start ¶
func Start(s PeerSubscriptionProvider, opts ...Option) *Peers
Start creates a Peers instance that is registered to `s`'s events and starts it.
func (*Peers) Close ¶
func (p *Peers) Close()
Close stops listening for events and waits for background worker to exit.
Click to show internal directories.
Click to hide internal directories.