netutil

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LocalIPv4

func LocalIPv4() string

LocalIPv4 returns the first non-loopback IPv4 address of the local machine.

The result is cached after the first call using sync.Once, so subsequent calls are fast. If no non-loopback IPv4 address is found, "0.0.0.0" is returned.

Note:

  • Only IPv4 addresses are considered; IPv6 addresses are ignored.
  • The result does not update if the network interfaces change after the first call.
  • For more robust use, consider returning (string, error) to handle the case where no valid IPv4 address is available.

Types

This section is empty.

Jump to

Keyboard shortcuts

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