peer

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_TAG_VALUE = 100

Variables

View Source
var (
	ErrAddrInfoAddrsEmpty = errors.New("addrInfo.Addrs is empty")
	ErrAlreadyConnected   = errors.New("already connected")
	ErrNickNotFound       = errors.New("Nick not found")
)

Functions

func AssertNick added in v0.4.0

func AssertNick(pid p2peer.ID) error

If a nick is not found, it creates and sets a new one.

func ConnectAndProtect added in v0.3.0

func ConnectAndProtect(ctx context.Context, h host.Host, pai p2peer.AddrInfo) error

func DeleteNick added in v0.4.0

func DeleteNick(id string)

func IsKnown added in v0.3.0

func IsKnown(peerID p2peer.ID) bool

func Lookup

func Lookup(q string) string

Lookup takes an input string that can be either a nick or an ID, and returns the corresponding ID if found; otherwise, it returns the input.

func LookupNick

func LookupNick(peerID p2peer.ID) string

LookupNick looks for a peer's nick by its ID. If it does not exist it returns the input

func Nick added in v0.4.0

func Nick(q string) (string, error)

Nick returns the nick for a given peer ID.

func Nicks added in v0.3.0

func Nicks() map[string]string

func PeerAddrInfoFromID added in v0.3.0

func PeerAddrInfoFromID(h host.Host, id p2peer.ID) (p2peer.AddrInfo, error)

func PeerAddrInfoFromPeerIDString added in v0.3.0

func PeerAddrInfoFromPeerIDString(h host.Host, id string) (p2peer.AddrInfo, error)

func Protect added in v0.3.0

func Protect(h host.Host, id p2peer.ID) error

func SetNick added in v0.4.0

func SetNick(id, nick string) error

SetNick updates or sets a new nick for a given peer ID.

func UnprotectPeer added in v0.3.0

func UnprotectPeer(h host.Host, id p2peer.ID)

func WatchCSV added in v0.4.0

func WatchCSV() error

Types

This section is empty.

Jump to

Keyboard shortcuts

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