geoip

package
v0.0.0-...-4d64e5c Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGeoIpDisabled = errors.New("geoip is disabled")
	ErrBadDB         = errors.New("bad db")
)

Functions

func GetDistance

func GetDistance(slat, slong, dlat, dlong float64) float64

Types

type Config

type Config struct {
	Enable    bool   `json:"enable"`
	CountryDB string `json:"country_db"`
	ASNDB     string `json:"asn_db"`
}

type GeoIp

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

func NewGeoIp

func NewGeoIp(config *Config) *GeoIp

func (*GeoIp) GetASN

func (g *GeoIp) GetASN(ip net.IP) (uint, error)

func (*GeoIp) GetCoordinates

func (g *GeoIp) GetCoordinates(ip net.IP) (latitude float64, longitude float64, err error)

func (*GeoIp) GetCountry

func (g *GeoIp) GetCountry(ip net.IP) (string, error)

Jump to

Keyboard shortcuts

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