ipdiscovery

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Interface string `json:"interface"`
	IP        string `json:"ip"`
	Network   string `json:"network"`
	IsIPv6    bool   `json:"is_ipv6"`
}

Address represents an IP address associated with a network interface

type Discovery

type Discovery struct {
	Addresses []Address `json:"addresses"`
}

Discovery holds information about discovered IP addresses

func Discover

func Discover(ctx context.Context, log *slog.Logger, opts Options) (*Discovery, error)

Discover gathers IP addresses from local interfaces and, when configured, from an external netcheck service for public IP discovery.

func DiscoverWithTimeout

func DiscoverWithTimeout(timeout time.Duration, log *slog.Logger, opts Options) (*Discovery, error)

DiscoverWithTimeout is a convenience function that adds a timeout to Discover

type Options added in v0.7.0

type Options struct {
	// NetcheckURL, when set, enables public IP discovery via a zero-port
	// netcheck request to the given URL. On cloud providers the external IP
	// isn't on any local interface, so this is the only way to find it.
	NetcheckURL string
}

Options configures IP discovery behavior.

Jump to

Keyboard shortcuts

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