data

package
v0.0.21 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ASN_IDC     = "IDC" //hosting
	ASN_ISP     = "ISP" //isp
	ASN_ORG     = "ORG" //cdn edu gov mil business
	ASN_UNKNOWN = "UNKNOWN"
)
View Source
const AllContinent = "AllContinent"
View Source
const AllCountry = "AllCountry"
View Source
const NA = "N/A"

Variables

This section is empty.

Functions

func GeoInfoEncode

func GeoInfoEncode(core_d *GeoInfo) ([]byte, error)

func GetContinentList

func GetContinentList() map[string]string

func GetCountryList

func GetCountryList() map[string]CountryData

func GetRegionList added in v0.0.21

func GetRegionList() map[string]RegionData

func IsLanIp added in v0.0.21

func IsLanIp(ip string) (bool, error)

Types

type ASN

type ASN struct {
	ASN  string `json:"asn"`
	Type string `json:"type"`
}

ASN represents the Autonomous System Number data returned from the API.

type CountryData

type CountryData struct {
	CountryCode   string `json:"country_code"`
	CountryName   string `json:"country_name"`
	ContinentCode string `json:"continent_code"`
	ContinentName string `json:"continent_name"`
}

func GetCountryInfo

func GetCountryInfo(countryCode string) CountryData

type GeoInfo

type GeoInfo struct {
	IP            string  `json:"ip"`
	Latitude      float64 `json:"latitude"`
	Longitude     float64 `json:"longitude"`
	CountryCode   string  `json:"country_code"`
	ContinentCode string  `json:"continent_code"`
	RegionCode    string  `json:"region_code"`
	ASN           ASN     `json:"asn"`
}

func GeoInfoDecode

func GeoInfoDecode(r_bytes []byte) (*GeoInfo, error)

type RegionData added in v0.0.21

type RegionData struct {
	Code string `json:"code"`
	Name string `json:"name"`
	Type string `json:"type"`
}

func GetRegionInfo added in v0.0.21

func GetRegionInfo(countryCode, regionCode string) RegionData

Jump to

Keyboard shortcuts

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