shared

package
v0.0.0-...-6321830 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFileSize          = errors.New("ip database file size error")
	ErrMetaData          = errors.New("ip database metadata error")
	ErrDatabaseError     = errors.New("database error")
	ErrIPFormat          = errors.New("query ip format error")
	ErrNoSupportLanguage = errors.New("language not support")
	ErrNoSupportIPv4     = errors.New("ipv4 not support")
	ErrNoSupportIPv6     = errors.New("ipv6 not support")
	ErrInvalidIPv4       = errors.New("invalid ipv4 address")
	ErrDataNotExists     = errors.New("data is not exists")
)

Functions

func ShowLibraryInfo

func ShowLibraryInfo(name string, seeker IPSeeker) string

Types

type IPSeeker

type IPSeeker interface {
	LookupByIP(address net.IP) (*Record, error)
	IPv4Support() bool
	IPv6Support() bool
	RecordCount() uint64
	BuildTime() time.Time
	fmt.Stringer
}

type Record

type Record struct {
	// IP
	IP      net.IP `json:",omitempty"`
	BeginIP net.IP `json:",omitempty"`
	EndIP   net.IP `json:",omitempty"`
	// GeoInfo
	CountryName string `json:",omitempty"`
	RegionName  string `json:",omitempty"`
	CityName    string `json:",omitempty"`
	// Owner
	OwnerDomain string `json:",omitempty"`
	ISPDomain   string `json:",omitempty"`
	// GeoCoding
	Latitude  string `json:",omitempty"`
	Longitude string `json:",omitempty"`
	// Time zone
	TimeZone  string `json:",omitempty"`
	UTCOffset string `json:",omitempty"`
	// Country Code
	//   IDDCode = International Direct Dialing
	//   GB2260Code = GB/T 2260
	//   ISO3166Alpha2Code = ISO 3166-1 alpha-2
	//   ISO3166Alpha3Code = ISO 3166-1 alpha-3
	IDDCode           string `json:",omitempty"`
	GB2260Code        string `json:",omitempty"`
	ISO3166Alpha2Code string `json:",omitempty"`
	ISO3166Alpha3Code string `json:",omitempty"`
	ContinentCode     string `json:",omitempty"`
	// Currency
	//   CurrencyCode = ISO 4217
	CurrencyCode string `json:",omitempty"`
	CurrencyName string `json:",omitempty"`
	// Service
	IDC         string `json:",omitempty"` // IDC | VPN
	BaseStation string `json:",omitempty"` // WiFi | BS (Base Station)
	// Other
	EuropeanUnion string `json:",omitempty"`
	AnyCast       string `json:",omitempty"`
}

func (*Record) String

func (r *Record) String() string

type Update

type Update interface {
	BuildTime() time.Time
	Size() uint64
	Download() (data []byte, err error)
}

Jump to

Keyboard shortcuts

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