endpoints

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectPublicAddresses

func DetectPublicAddresses(ctx context.Context) ([]netip.Addr, error)

DetectPublicAddresses detects the public addresses of the machine using the opendns resolver service.

Types

type DetectOpts

type DetectOpts struct {
	// DetectIPv6 enables IPv6 detection.
	DetectIPv6 bool
	// DetectPrivate enables private address detection.
	DetectPrivate bool
	// AllowRemoteDetection enables remote address detection.
	AllowRemoteDetection bool
	// SkipInterfaces contains a list of interfaces to skip.
	SkipInterfaces []string
}

DetectOpts contains options for endpoint detection.

type PrefixList

type PrefixList []netip.Prefix

func Detect

func Detect(ctx context.Context, opts DetectOpts) (PrefixList, error)

Detect detects endpoints for this machine.

func (PrefixList) AddrPorts

func (a PrefixList) AddrPorts(port uint16) []netip.AddrPort

func (PrefixList) AddrStrings

func (a PrefixList) AddrStrings() []string

func (PrefixList) Contains

func (a PrefixList) Contains(addr netip.Addr) bool

func (PrefixList) Len

func (a PrefixList) Len() int

func (PrefixList) Less

func (a PrefixList) Less(i, j int) bool

Sort by IPv4 addresses first, then IPv6 addresses.

func (PrefixList) Strings

func (a PrefixList) Strings() []string

func (PrefixList) Swap

func (a PrefixList) Swap(i, j int)

func (PrefixList) WebmeshMultiaddrs

func (a PrefixList) WebmeshMultiaddrs(proto string, port uint16, peerID peer.ID) []ma.Multiaddr

Jump to

Keyboard shortcuts

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