address

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAddrParse    = errors.New("error while parsing address")
	TargetAddrEmpty = errors.New("target addr empty")
)

Functions

This section is empty.

Types

type PeerAddressInfo

type PeerAddressInfo struct {
	Id          PeerId                 // Id of the peer, Usually a random. Generally Open source Impls follow hash(pub_key)
	IpV4Addr    string                 // IpV4Addr of the the service.
	Port        int32                  // The service Port
	IsBehindNAT PeerReachabilityStatus // Is the specified peer behind NAT Gateway To be used after Dial backs are introduced.
}

PeerAddressInfo is the basic Peer Structure for communication. Serialized format is ipv4/0.0.0.0#port/5959#id/peerId

func FromSerializedAddr

func FromSerializedAddr(sAddr string) (PeerAddressInfo, error)

FromSerializedAddr parses the given Serialized Addr and returns PeerAddressInfo

func (*PeerAddressInfo) ToSerializedAddressFormat

func (addr *PeerAddressInfo) ToSerializedAddressFormat() (string, error)

ToSerializedAddressFormat Serializes the PeerAddressInfo and returns.

type PeerId

type PeerId string

func GenerateNew

func GenerateNew() PeerId

GenerateNew generates a new peer Id. Usually open source implementations follow sha256(pub_key)

type PeerReachabilityStatus

type PeerReachabilityStatus int32
const (
	BehindNAT PeerReachabilityStatus = 0x1
	Public    PeerReachabilityStatus = 0x2
	Unknown   PeerReachabilityStatus = 0x3
)

Jump to

Keyboard shortcuts

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