geoip

package
v0.0.0-...-c009e49 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeDistance

func ComputeDistance(lat1, lon1, lat2, lon2 float64) float64

Types

type GeoIPDB

type GeoIPDB struct {
	CityDB *geoip2.Reader
	ASNDB  *geoip2.Reader
}

GeoIPDB is the main struct of ip lookup engine

func New

func New(cityDBPrefix string, asnDBPrefix string) *GeoIPDB

New is used to create database

func (*GeoIPDB) Lookup

func (g *GeoIPDB) Lookup(ipAddr string) GeoLocation

Lookup is used to find IP location in GeoIPDB

type GeoLocation

type GeoLocation struct {
	City      string
	Region    string
	Country   string
	ASN       uint
	SPName    string
	Latitude  float64
	Longitude float64
}

GeoLocation is the response type for location lookup

func (GeoLocation) String

func (g GeoLocation) String() string

Jump to

Keyboard shortcuts

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