ipdb

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package ipdb define the interface for ip location or isp.

Index

Constants

View Source
const (
	IPV4Len       = 4
	FileSeparator = " "
)

Variables

View Source
var BitConvTemplate = []string{}/* 256 elements not displayed */
View Source
var IspValid = map[string]string{
	"chinanet": "中国电信",
	"cmcc":     "中国移动",
	"unicom":   "中国联通",
	"tietong":  "中国铁通",
	"cernet":   "教育网",
	"cstnet":   "科技网",
	"drpeng":   "鹏博士",
	"googlecn": "谷歌中国",
}

Functions

func BuildContryCity

func BuildContryCity(csvFile, outputFile string) error

func MergeISP

func MergeISP(from, to string) error

func ParseIPCIDR

func ParseIPCIDR(ipCidr string) (string, error)

Types

type CheckData added in v1.0.9

type CheckData func(*IPdbRecord) *IPdbRecord

type IPdb

type IPdb interface {
	Init(dataDir string, config map[string]string) //deprecated
	Geo(ip string) (*IPdbRecord, error)
	GeoWithChecker(ip string, check CheckData) (*IPdbRecord, error)
	SearchIsp(ip string) string
}

type IPdbRecord

type IPdbRecord struct {
	Country   string
	Region    string
	City      string
	Isp       string
	Latitude  float32
	Longitude float32
	Timezone  string
	Areacode  string
}

func (*IPdbRecord) CheckData

func (record *IPdbRecord) CheckData() *IPdbRecord

Directories

Path Synopsis
Package geoip implement ipdb.
Package geoip implement ipdb.
Package iploc implement ipdb.
Package iploc implement ipdb.

Jump to

Keyboard shortcuts

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