peernotifier

package
v0.0.0-...-dfc2b99 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: ISC, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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() er.R

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, er.R)

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