endpoints

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: Apache-2.0 Imports: 7 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) 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)

Jump to

Keyboard shortcuts

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