Documentation ¶
Index ¶
- func DetectPublicAddresses(ctx context.Context) ([]netip.Addr, error)
- type DetectOpts
- type PrefixList
- func (a PrefixList) AddrPorts(port uint16) []netip.AddrPort
- func (a PrefixList) AddrStrings() []string
- func (a PrefixList) Contains(addr netip.Addr) bool
- func (a PrefixList) FirstPublicAddr() netip.Addr
- func (a PrefixList) Len() int
- func (a PrefixList) Less(i, j int) bool
- func (a PrefixList) PrivateAddrs() []netip.Addr
- func (a PrefixList) PublicAddrs() []netip.Addr
- func (a PrefixList) Strings() []string
- func (a PrefixList) Swap(i, j int)
- func (a PrefixList) WebmeshMultiaddrs(proto string, port uint16, peerID peer.ID) []ma.Multiaddr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
PrefixList wraps a list of network prefixes with added functionality.
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) FirstPublicAddr ¶ added in v0.10.1
func (a PrefixList) FirstPublicAddr() netip.Addr
func (PrefixList) Len ¶
func (a PrefixList) Len() int
func (PrefixList) Less ¶
func (a PrefixList) Less(i, j int) bool
Sort by Public addresses first. Then IPv4 addresses and finally IPv6 addresses.
func (PrefixList) PrivateAddrs ¶ added in v0.12.0
func (a PrefixList) PrivateAddrs() []netip.Addr
func (PrefixList) PublicAddrs ¶ added in v0.12.0
func (a PrefixList) PublicAddrs() []netip.Addr
func (PrefixList) Strings ¶
func (a PrefixList) Strings() []string
func (PrefixList) Swap ¶
func (a PrefixList) Swap(i, j int)
func (PrefixList) WebmeshMultiaddrs ¶
Click to show internal directories.
Click to hide internal directories.