geoip

package
v0.0.0-...-b295479 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GeoIPRetriever

type GeoIPRetriever interface {
	Start(context.Context, *errgroup.Group)
	WaitForUpdate()
	GetCountryAndContinent(context.Context, netip.Addr) (country string, continent string, err error)
}

type MaxmindConfig

type MaxmindConfig struct {
	MaxmindDownloadURL string
	MaxmindAccountID   string
	MaxmindLicenseKey  string
}

Configuration variables for the MaxmindManager components.

type MaxmindManager

type MaxmindManager struct {
	// contains filtered or unexported fields
}

MaxmindManager is the component which enables lookups for GeoIP information of resolvers.

func NewMaxmind

func NewMaxmind(conf MaxmindConfig) *MaxmindManager

func (*MaxmindManager) GetCountryAndContinent

func (m *MaxmindManager) GetCountryAndContinent(ctx context.Context, ip netip.Addr) (country string, continent string, err error)

Retrieve the country code and continent code for a given ip address. Blocks while MaxMind is unavailable.

func (*MaxmindManager) Start

func (m *MaxmindManager) Start(ctx context.Context, group *errgroup.Group)

Start the MaxmindManager by downloading the Country database and keeping it up to date.

func (*MaxmindManager) WaitForUpdate

func (m *MaxmindManager) WaitForUpdate()

Lets another component wait for the updated Condition.

Jump to

Keyboard shortcuts

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