ip2locationio

package module
v0.0.0-...-c2d12bf Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

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

The Configuration struct stores the IP2Location.io API key.

func OpenConfiguration

func OpenConfiguration(apikey string) (*Configuration, error)

OpenConfiguration initializes with the IP2Location.io API key

type DomainWhois

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

The DomainWhois struct is the main object used to query the IP2WHOIS API.

func OpenDomainWhois

func OpenDomainWhois(config *Configuration) (*DomainWhois, error)

OpenDomainWhois initializes with the Configuration object

func (*DomainWhois) GetDomainExtension

func (a *DomainWhois) GetDomainExtension(str string) (string, error)

GetDomainExtension will return the domain extension from an URL/domain

func (*DomainWhois) GetDomainName

func (a *DomainWhois) GetDomainName(fullURL string) (string, error)

GetDomainName will return the domain name from an URL

func (*DomainWhois) GetNormalText

func (a *DomainWhois) GetNormalText(domain string) (string, error)

GetNormalText will convert Punycode to normal text

func (*DomainWhois) GetPunycode

func (a *DomainWhois) GetPunycode(domain string) (string, error)

GetPunycode will convert normal text to Punycode

func (*DomainWhois) LookUp

func (a *DomainWhois) LookUp(domain string) (DomainWhoisResult, error)

LookUp will return all WHOIS fields based on the queried domain

type DomainWhoisError

type DomainWhoisError struct {
	Error struct {
		ErrorCode    int    `json:"error_code"`
		ErrorMessage string `json:"error_message"`
	} `json:"error"`
}

The DomainWhoisError struct stores errors returned by the IP2WHOIS API.

type DomainWhoisResult

type DomainWhoisResult struct {
	Domain      string    `json:"domain"`
	DomainID    string    `json:"domain_id"`
	Status      string    `json:"status"`
	CreateDate  time.Time `json:"create_date"`
	UpdateDate  time.Time `json:"update_date"`
	ExpireDate  time.Time `json:"expire_date"`
	DomainAge   int       `json:"domain_age"`
	WhoisServer string    `json:"whois_server"`
	Registrar   struct {
		IanaID string `json:"iana_id"`
		Name   string `json:"name"`
		Url    string `json:"url"`
	} `json:"registrar"`
	Registrant struct {
		Name          string `json:"name"`
		Organization  string `json:"organization"`
		StreetAddress string `json:"street_address"`
		City          string `json:"city"`
		Region        string `json:"region"`
		ZipCode       string `json:"zip_code"`
		Country       string `json:"country"`
		Phone         string `json:"phone"`
		Fax           string `json:"fax"`
		Email         string `json:"email"`
	} `json:"registrant"`
	Admin struct {
		Name          string `json:"name"`
		Organization  string `json:"organization"`
		StreetAddress string `json:"street_address"`
		City          string `json:"city"`
		Region        string `json:"region"`
		ZipCode       string `json:"zip_code"`
		Country       string `json:"country"`
		Phone         string `json:"phone"`
		Fax           string `json:"fax"`
		Email         string `json:"email"`
	} `json:"admin"`
	Tech struct {
		Name          string `json:"name"`
		Organization  string `json:"organization"`
		StreetAddress string `json:"street_address"`
		City          string `json:"city"`
		Region        string `json:"region"`
		ZipCode       string `json:"zip_code"`
		Country       string `json:"country"`
		Phone         string `json:"phone"`
		Fax           string `json:"fax"`
		Email         string `json:"email"`
	} `json:"tech"`
	Billing struct {
		Name          string `json:"name"`
		Organization  string `json:"organization"`
		StreetAddress string `json:"street_address"`
		City          string `json:"city"`
		Region        string `json:"region"`
		ZipCode       string `json:"zip_code"`
		Country       string `json:"country"`
		Phone         string `json:"phone"`
		Fax           string `json:"fax"`
		Email         string `json:"email"`
	} `json:"billing"`
	Nameservers []string `json:"nameservers"`
}

The DomainWhoisResult struct stores all of the available WHOIS info found in the IP2WHOIS API.

type IPGeolocation

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

The IPGeolocation struct is the main object used to query the IP2Location.io API.

func OpenIPGeolocation

func OpenIPGeolocation(config *Configuration) (*IPGeolocation, error)

OpenIPGeolocation initializes with the Configuration object

func (*IPGeolocation) LookUp

func (a *IPGeolocation) LookUp(ip string, lang string) (IPGeolocationResult, error)

LookUp will return all geolocation fields based on the queried IP address

type IPGeolocationError

type IPGeolocationError struct {
	Error struct {
		ErrorCode    int    `json:"error_code"`
		ErrorMessage string `json:"error_message"`
	} `json:"error"`
}

The IPGeolocationError struct stores errors returned by the IP2Location.io API.

type IPGeolocationResult

type IPGeolocationResult struct {
	IP                 string  `json:"ip"`
	CountryCode        string  `json:"country_code"`
	CountryName        string  `json:"country_name"`
	RegionName         string  `json:"region_name"`
	CityName           string  `json:"city_name"`
	Latitude           float64 `json:"latitude"`
	Longitude          float64 `json:"longitude"`
	ZipCode            string  `json:"zip_code"`
	TimeZone           string  `json:"time_zone"`
	Asn                string  `json:"asn"`
	AS                 string  `json:"as"`
	Isp                string  `json:"isp"`
	Domain             string  `json:"domain"`
	NetSpeed           string  `json:"net_speed"`
	IddCode            string  `json:"idd_code"`
	AreaCode           string  `json:"area_code"`
	WeatherStationCode string  `json:"weather_station_code"`
	WeatherStationName string  `json:"weather_station_name"`
	Mcc                string  `json:"mcc"`
	Mnc                string  `json:"mnc"`
	MobileBrand        string  `json:"mobile_brand"`
	Elevation          int     `json:"elevation"`
	UsageType          string  `json:"usage_type"`
	AddressType        string  `json:"address_type"`
	Continent          struct {
		Name        string   `json:"name"`
		Code        string   `json:"code"`
		Hemisphere  []string `json:"hemisphere"`
		Translation struct {
			Lang  string `json:"lang"`
			Value string `json:"value"`
		} `json:"translation"`
	} `json:"continent"`
	District string `json:"district"`
	Country  struct {
		Name        string `json:"name"`
		Alpha3Code  string `json:"alpha3_code"`
		NumericCode int    `json:"numeric_code"`
		Demonym     string `json:"demonym"`
		Flag        string `json:"flag"`
		Capital     string `json:"capital"`
		TotalArea   int    `json:"total_area"`
		Population  int    `json:"population"`
		Currency    struct {
			Code   string `json:"code"`
			Name   string `json:"name"`
			Symbol string `json:"symbol"`
		} `json:"currency"`
		Language struct {
			Code string `json:"code"`
			Name string `json:"name"`
		} `json:"language"`
		Tld         string `json:"tld"`
		Translation struct {
			Lang  string `json:"lang"`
			Value string `json:"value"`
		} `json:"translation"`
	} `json:"country"`
	Region struct {
		Name        string `json:"name"`
		Code        string `json:"code"`
		Translation struct {
			Lang  string `json:"lang"`
			Value string `json:"value"`
		} `json:"translation"`
	} `json:"region"`
	City struct {
		Name        string `json:"name"`
		Translation struct {
			Lang  string `json:"lang"`
			Value string `json:"value"`
		} `json:"translation"`
	} `json:"city"`
	TimeZoneInfo struct {
		Olson       string `json:"olson"`
		CurrentTime string `json:"current_time"`
		GmtOffset   int    `json:"gmt_offset"`
		IsDst       bool   `json:"is_dst"`
		Sunrise     string `json:"sunrise"`
		Sunset      string `json:"sunset"`
	} `json:"time_zone_info"`
	Geotargeting struct {
		Metro string `json:"metro"`
	} `json:"geotargeting"`
	AdsCategory     string `json:"ads_category"`
	AdsCategoryName string `json:"ads_category_name"`
	IsProxy         bool   `json:"is_proxy"`
	Proxy           struct {
		LastSeen  int    `json:"last_seen"`
		ProxyType string `json:"proxy_type"`
		Threat    string `json:"threat"`
		Provider  string `json:"provider"`
	} `json:"proxy"`
}

The IPGeolocationResult struct stores all of the available geolocation info found in the IP2Location.io API.

Jump to

Keyboard shortcuts

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