geoip

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: MIT Imports: 7 Imported by: 0

README

geoip

GEO IP resolve utils

build and import to database


build and export to sqlite db file


Documentation

Index

Constants

View Source
const (
	CZNET = "纯真网络"
	CZ88  = "CZ88.NET"
)

Variables

This section is empty.

Functions

func IP2Uint

func IP2Uint(ip string) uint32

func Uint2IP

func Uint2IP(ip uint32) string

Types

type GeoData

type GeoData struct {
	IPBegin       string `json:"ip_begin"`
	IPBeginUint32 uint32 `json:"ip_begin_uint32"`
	IPEnd         string `json:"ip_end"`
	IPEndUint32   uint32 `json:"ip_end_uint32"`
	Country       string `json:"country"`
	Province      string `json:"province"`
	City          string `json:"city"`
	Area          string `json:"area"`
}

type GeoIP

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

func NewGeoIP

func NewGeoIP(strDatFile string) (*GeoIP, error)

func (*GeoIP) Find

func (g *GeoIP) Find(ip string) *GeoLocation

type GeoLocation

type GeoLocation struct {
	IP       string `json:"ip"`
	Country  string `json:"country"`
	Province string `json:"province"`
	City     string `json:"city"`
	Area     string `json:"area"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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