godock: github.com/sqp/godock/libs/net/iplocation Index | Files

package iplocation

import "github.com/sqp/godock/libs/net/iplocation"

Package iplocation detects your location based on your IP.


Package Files



const URL = "http://ip-api.com/json"

URL points to the location of the IP locale info API.

type Data Uses

type Data struct {
    Status      string  `json:"status"`
    Country     string  `json:"country"`
    CountryCode string  `json:"countryCode"`
    Region      string  `json:"region"`
    RegionName  string  `json:"regionName"`
    City        string  `json:"city"`
    Zip         string  `json:"zip"`
    Lat         float64 `json:"lat"`
    Lon         float64 `json:"lon"`
    Timezone    string  `json:"timezone"`
    ISP         string  `json:"isp"`
    ORG         string  `json:"org"`
    AS          string  `json:"as"`
    Message     string  `json:"message"`
    Query       string  `json:"query"`

Data will hold the result of the query to get the IP address of the caller.

func Get Uses

func Get() (*Data, error)

Get will get the location details based on current IP location.

Package iplocation imports 1 packages (graph) and is imported by 1 packages. Updated 2016-08-24. Refresh now. Tools for package owners.