geoip

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 2 Imported by: 3

Documentation

Overview

Package geoip helps in geolocation operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Locator

type Locator interface {
	// GetCountry retrieves the ISO country code for a given IP address.
	// Returns an error if the IP lookup fails.
	GetCountry(ip net.IP) (string, error)

	// GetPosition retrieves the geographical [Position] for a given IP
	// address. Returns an error if the IP lookup fails.
	GetPosition(ip net.IP) (Position, error)
}

func NewNullGeoLite

func NewNullGeoLite() Locator

NewNullGeoLite opens a connection to GeoIp2 database and return a geoLite2 structure with the database connection.

The connection uses the local database or try to download it from MaxMind's server (the download required `MAXMIND_LICENSE`).

type Position

type Position struct {
	Longitude, Latitude float64
}

Position represents a position, longitude and latitude, in the globe.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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