peernotifier

package
v0.10.0-beta Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.

func UseLogger

func UseLogger(logger btclog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using btclog.

Types

type PeerNotifier

type PeerNotifier struct {
	// contains filtered or unexported fields
}

PeerNotifier is a subsystem which observes peer offline and online events. It takes subscriptions for its events, and whenever it observes a new event it notifies its subscribers over the proper channel.

func New

func New() *PeerNotifier

New creates a new peer notifier which notifies clients of peer online and offline events.

func (*PeerNotifier) NotifyPeerOffline

func (p *PeerNotifier) NotifyPeerOffline(pubKey [33]byte)

NotifyPeerOffline sends a peer offline event to all the clients subscribed to the peer notifier.

func (*PeerNotifier) NotifyPeerOnline

func (p *PeerNotifier) NotifyPeerOnline(pubKey [33]byte)

NotifyPeerOnline sends a peer online event to all clients subscribed to the peer notifier.

func (*PeerNotifier) Start

func (p *PeerNotifier) Start() error

Start starts the PeerNotifier's subscription server.

func (*PeerNotifier) Stop

func (p *PeerNotifier) Stop()

Stop signals the notifier for a graceful shutdown.

func (*PeerNotifier) SubscribePeerEvents

func (p *PeerNotifier) SubscribePeerEvents() (*subscribe.Client, error)

SubscribePeerEvents returns a subscribe.Client that will receive updates any time the Server is informed of a peer event.

type PeerOfflineEvent

type PeerOfflineEvent struct {
	// PubKey is the peer's compressed public key.
	PubKey [33]byte
}

PeerOfflineEvent represents a new event where a peer goes offline.

type PeerOnlineEvent

type PeerOnlineEvent struct {
	// PubKey is the peer's compressed public key.
	PubKey [33]byte
}

PeerOnlineEvent represents a new event where a peer comes online.

Jump to

Keyboard shortcuts

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