peer

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Peer

type Peer struct {
	// a unique id of the Peer (e.g. sha256 fingerprint of the Wireguard public key)
	Id string

	//a gRpc connection stream to the Peer
	Stream proto.SignalExchange_ConnectStreamServer
}

Peer representation of a connected Peer

func NewPeer

NewPeer creates a new instance of a connected Peer

type Registry

type Registry struct {
	// Peer.key -> Peer
	Peers sync.Map
}

Registry registry that holds all currently connected Peers

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new connected Peer registry

func (*Registry) Deregister added in v0.0.8

func (registry *Registry) Deregister(peer *Peer)

Deregister deregister Peer from the Registry (usually once it disconnects)

func (*Registry) Get added in v0.0.8

func (registry *Registry) Get(peerId string) (*Peer, bool)

Get gets a peer from the registry

func (*Registry) IsPeerRegistered added in v0.0.8

func (registry *Registry) IsPeerRegistered(peerId string) bool

func (*Registry) Register

func (registry *Registry) Register(peer *Peer)

Register registers peer in the registry

Jump to

Keyboard shortcuts

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