netutil

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package netutil provides helpers for enumerating local network addresses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SuggestedLAN

func SuggestedLAN() (string, error)

SuggestedLAN returns the first private LAN IPv4 on an up, non-loopback interface.

Types

type Host

type Host struct {
	Address   string `json:"address"`
	Label     string `json:"label"`
	Kind      string `json:"kind"` // loopback, any, lan, link_local, other
	Suggested bool   `json:"suggested,omitempty"`
}

Host describes a bindable listen address with a human label.

type HostsResult

type HostsResult struct {
	Hosts        []Host `json:"hosts"`
	Suggested    string `json:"suggested"`              // best default listen host for mobile Wi‑Fi proxy
	SuggestedLAN string `json:"suggestedLAN,omitempty"` // first private LAN IPv4, if any
}

HostsResult is returned by ListListenHosts.

func ListListenHosts

func ListListenHosts() HostsResult

ListListenHosts returns loopback, all-interfaces, and interface IPs suitable for proxy/control bind pickers. Suggested is the best LAN IPv4 for device Wi‑Fi setup.

Jump to

Keyboard shortcuts

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