geoip

package
v0.8.2-rc.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2021 License: Apache-2.0 Imports: 12 Imported by: 3

Documentation

Overview

Package geoip helps in geolocation operations.

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(ip net.IP) (string, error)
	GetPosition(ip net.IP) (Position, error)
}

func NewGeoLite2

func NewGeoLite2() (Locator, error)

NewGeoLite2 opens connections to GeoIp2 databases and return a geoLite2 structure with the databases connections.

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

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