common

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DiscProto     = "/disc/0.1"
	IdentityProto = "/id/0.1"
)
View Source
const DNSRegex = `^/?(dns)(4|6)?/[^-|^/][A-Za-z0-9-]([^-|^/]?)+([\\-\\.]{1}[a-z0-9]+)*\\.[A-Za-z]{2,}(/?)$`

DNSRegex is a regex string to match against a valid dns/dns4/dns6 addr

Variables

View Source
var (
	ErrInvalidMultiaddr        = errors.New("invalid multiaddr")
	ErrCouldNotCreateMultiaddr = errors.New("could not create a multi address")

	ErrMultiaddrNoFoundIP   = errors.New("no IP address found")
	ErrMultiaddrContainsDNS = errors.New("multiaddr contains dns")
)

Functions

func AddrInfoToString

func AddrInfoToString(addr *peer.AddrInfo) string

AddrInfoToString converts an AddrInfo into a string representation that can be dialed from another node

func MultiAddrFromDNS

func MultiAddrFromDNS(addr string, port int) (multiaddr.Multiaddr, error)

MultiAddrFromDNS constructs a multiAddr from the passed in DNS address and port combination

func ParseMultiaddrIP added in v1.2.2

func ParseMultiaddrIP(ma multiaddr.Multiaddr) (net.IP, error)

ParseMultiaddrIP parse a multiaddr into a net.IP

func StringToAddrInfo

func StringToAddrInfo(addr string) (*peer.AddrInfo, error)

Types

type DialPriority

type DialPriority uint64
const (
	PriorityRequestedDial DialPriority = 1
	PriorityRandomDial    DialPriority = 10
)

Jump to

Keyboard shortcuts

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