geoIp

package
v1.1.16 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GeoIpASNDB *geoip2.Reader
View Source
var GeoIpDBCurVersion string

Functions

func FindFromIPAPI added in v1.1.12

func FindFromIPAPI(ip string) (countryCode string, err error)

func GeoIpBinary added in v0.9.0

func GeoIpBinary(url string) (data []byte, err error)

func GeoIpVersion added in v0.9.0

func GeoIpVersion(url string) (version string, err error)

func GetASN added in v1.1.0

func GetASN(ipStr string) (string, error)

GetASN returns the ASN organization for an IP

func InitGeoIpASNDB added in v1.1.0

func InitGeoIpASNDB()

func InitGeoIpDB

func InitGeoIpDB() error

func IsCDN added in v1.1.0

func IsCDN(ipStr string) bool

IsCDN checks if the IP belongs to a CDN based on local ASN DB

func ReInitGeoIpDB added in v0.9.0

func ReInitGeoIpDB()

func UpdateGeoIP added in v0.9.0

func UpdateGeoIP()

new geoip from db file

func UpdateGeoIpASNDB added in v1.1.0

func UpdateGeoIpASNDB()

UpdateGeoIpASNDB Force download daily

Types

type CountryEmoji

type CountryEmoji struct {
	Code  string `json:"code"`
	Emoji string `json:"emoji"`
}

type GeoIP

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

GeoIP2

var GeoIpDB GeoIP

func NewGeoIP

func NewGeoIP(geodb, flags string) (geoip GeoIP)

new geoip from db file

func (GeoIP) Find

func (g GeoIP) Find(ipORdomain string) (ip, country string, err error)

Find ip info

func (GeoIP) FindCountryIsoEmoji added in v1.0.5

func (g GeoIP) FindCountryIsoEmoji(countryIsoCode string) string

type IPAPIResponse added in v1.1.12

type IPAPIResponse struct {
	CountryCode string `json:"countryCode"`
	Status      string `json:"status"`
	Message     string `json:"message"`
}

Jump to

Keyboard shortcuts

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