maxmind

package
v0.0.0-...-8dfb9f7 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when City lookups return no results.
	ErrNotFound = errors.New("no results found during lookup")
)

Functions

This section is empty.

Types

type Maxmind

type Maxmind struct {
	Maxmind *geoip2.Reader
	// contains filtered or unexported fields
}

Maxmind manages access to the maxmind database.

func NewMaxmind

func NewMaxmind(src content.Provider) *Maxmind

NewMaxmind creates a new Maxmind instance which loads data from the given content.Provider. Callers must call Reload() at least once on the returned Maxmind instance before calling City().

func (*Maxmind) City

func (mm *Maxmind) City(ip net.IP) (*geoip2.City, error)

City searches for metadata associated with the given IP.

func (*Maxmind) Reload

func (mm *Maxmind) Reload(ctx context.Context) error

Reload is intended to be called regularly to update the local dataset with newer information from the provider.

Jump to

Keyboard shortcuts

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