geo

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package geo resolves a client IP to an ISO 3166-1 alpha-2 country code using a pure-Go, embedded database (no external service, no file to mount). It is privacy-preserving by construction: callers resolve the country at request time and immediately discard the IP — GateCHA never stores or logs the raw address, only the aggregated country.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Country

func Country(ip string) string

Country returns the uppercase ISO 3166-1 alpha-2 code for ip, or "" when the address is empty, unparseable, private/loopback/link-local, or unknown to the embedded database. An empty result means "unknown" and should render without a flag.

Types

This section is empty.

Jump to

Keyboard shortcuts

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