ipinfo

package module
v0.0.0-...-89b1d59 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: MIT Imports: 8 Imported by: 0

README

Go Reference

ipinfo

Small library to get public IPv4/IPv6 Currently uses ipify api (api.ipify.org & api6.ipify.org)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoIPv6Interface = fmt.Errorf("no ipv6 interfaces found")
View Source
var HttpTimeout = time.Second * 30

Functions

func PublicIPv4

func PublicIPv4(ctx context.Context) (netip.Addr, error)

PublicIPv4 gets public IPv4 addr by fetching IP from an external service (ipify).

func PublicIPv6

func PublicIPv6(ctx context.Context) (netip.Addr, error)

PublicIPv6 gets public IPv6 addr, first by testing available non-loopback ipv6 interface, then by fetching IP from an external service (ipify). This is a faster (local check for fast fail) and more reliable (actual request over the internet) way of detecting ipv6

Types

This section is empty.

Jump to

Keyboard shortcuts

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