hostinfo

package
v0.0.0-...-60784e1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package hostinfo derives runtime host information used by laptop-mode CLI defaulting (e.g. host IP → nip.io fallback for ingress.domain).

Kept separate from the translator so the translator stays deterministic and unit-testable: anything host-derived flows in via call sites that explicitly fetch it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectHostIP

func DetectHostIP() (string, error)

DetectHostIP returns the IPv4 address that would be used as the source when reaching the outside world. The UDP "fake dial" trick: opening a UDP socket toward a routable address makes the OS populate the local address with the route's source IP, without sending any packet.

This deliberately does NOT use net.InterfaceAddrs(): on a typical laptop that returns five-plus addresses (loopback, multiple interfaces, IPv6 link-locals) and we'd guess at which one is reachable from a workshop container running in kind.

func NipDomain

func NipDomain(ip string) string

NipDomain converts a dotted-quad IPv4 (e.g. 192.168.1.10) into the nip.io wildcard subdomain shape (192-168-1-10.nip.io). nip.io serves both `1-2-3-4.nip.io` and `1.2.3.4.nip.io`; the dash form survives Kubernetes' DNS label length / character restrictions when subdomains are prepended (e.g. workshop names).

Types

This section is empty.

Jump to

Keyboard shortcuts

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