Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct { Status string `json:"status,omitempty" meridian:"disable"` Message string `json:"message,omitempty" meridian:"disable"` Continent string `json:"continent,omitempty" description:"Full name of continent" ex:"North America"` ContinentCode string `json:"continentCode,omitempty" description:"Shorthand name of continent" ex:"NA"` Country string `json:"country,omitempty" description:"Full name of country" ex:"United States"` CountryCode string `json:"countryCode,omitempty" description:"Shorthand name of country" ex:"US"` Region string `json:"region,omitempty" description:"Shorthand name of region, state, etc." ex:"CA"` RegionName string `json:"regionName,omitempty" description:"Full name of region, state, etc." ex:"California"` City string `json:"city,omitempty" description:"Full name of city" ex:"San Francisco"` District string `json:"district,omitempty" description:"Full name of city district" ex:"South of Market"` ZIP string `json:"zip,omitempty" description:"Postal code" ex:"94103"` Latitude float64 `json:"lat"` Longitude float64 `json:"lon"` Timezone string `json:"timezone,omitempty" description:"tzdata name of timezone" ex:"America/Los_Angeles"` TimezoneOffset int `json:"offset" description:"Offset in seconds from UTC" ex:"-28800 for America/Los_Angeles"` ISP string `json:"isp,omitempty" description:"Name of ISP" ex:"Comcast Cable Communications, LLC"` ORG string `json:"org,omitempty" description:"Organizational owner of IP, usually ISP" ex:"Comcast Cable Communications, Inc"` ASN string `json:"as,omitempty" description:"AS name and number for current IP" ex:"AS7922 Comcast Cable Communications, LLC"` Mobile bool `json:"mobile" description:"Whether or not you are on a mobile network"` Proxy bool `json:"proxy" description:"Whether or not you are using a proxy"` IP string `json:"query,omitempty" description:"Current IP address" ex:"0.0.0.0"` }
Info stores location query results.
func (*Info) New ¶
New takes an optional location (IP address or domain name) and returns geolocation information about the location.
func (*Info) ToDescription ¶
ToDescription returns a formatted description of all fields in the Info struct.
func (*Info) ToJSON ¶
ToJSON takes a list of fields to convert to JSON byte array from a Info struct and returns the byte array with only those fields (unless the All specifier is given), regardless of whether or not the fields are set in the Info struct.
func (*Info) ToString ¶
ToString returns a formatted string representation of the Info struct. The optional fields argument takes a list of fields to output. Giving no arguments will output an empty string. Specifying "All" will return all fields.
func (*Info) ValidateFields ¶
ValidateFields validates that the given field names exist within the given Info object.