location

package
v3.2.3 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidIP = errors.New("invalid IP address")

Functions

func GeneralLocalizedCountryCity

func GeneralLocalizedCountryCity(record *geoip2.City, lang language.Tag, fallback language.Tag) string

func LocaleFromLanguage

func LocaleFromLanguage(t language.Tag) string

https://dev.maxmind.com/geoip/docs/databases/enterprise/#locations-files locales: “de”, “en”, “es”, “fr”, “ja”, “pt-BR”, “ru”, “zh-CN”

Types

type GEOIP2

type GEOIP2 struct {
	*geoip2.Reader
}

func New

func New(file string) (*GEOIP2, error)

func NewFromBytes

func NewFromBytes(data []byte) (*GEOIP2, error)

func (*GEOIP2) GetCity

func (g *GEOIP2) GetCity(_ context.Context, addr string) (*geoip2.City, error)

Jump to

Keyboard shortcuts

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