libp2ppeer

package
v0.0.0-...-2db71d7 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: Apache-2.0, Apache-2.0, MIT, + 2 more Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AdvancedEnableInlining = true
View Source
var ErrInvalidAddr = fmt.Errorf("invalid p2p multiaddr")

Functions

func IDB58Encode deprecated

func IDB58Encode(id ID) string

IDB58Encode returns the base58-encoded multihash representation of the ID.

Deprecated: Use Encode.

Types

type AddrInfo

type AddrInfo struct {
	ID    ID
	Addrs []ma.Multiaddr
}

func AddrInfoFromP2pAddr

func AddrInfoFromP2pAddr(m ma.Multiaddr) (*AddrInfo, error)

AddrInfoFromP2pAddr converts a Multiaddr to an AddrInfo.

func (AddrInfo) String

func (pi AddrInfo) String() string

type ID

type ID string

func IDFromPublicKey

func IDFromPublicKey(pk libp2pcrypto.PubKey) (ID, error)

IDFromPublicKey returns the Peer ID corresponding to the public key pk.

func SplitAddr

func SplitAddr(m ma.Multiaddr) (transport ma.Multiaddr, id ID)

SplitAddr splits a p2p Multiaddr into a transport multiaddr and a peer ID.

* Returns a nil transport if the address only contains a /p2p part. * Returns a empty peer ID if the address doesn't contain a /p2p part.

func (ID) Pretty

func (id ID) Pretty() string

Pretty returns a base58-encoded string representation of the ID.

Jump to

Keyboard shortcuts

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