ips

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIP

func GetIP(c *gin.Context) string

func GetLocalHost

func GetLocalHost() string

GetLocalHost 获取局域网ip地址

func GetLocation

func GetLocation(ip, key string) string

GetLocation 获取外网ip地址

func GetLocationByIp

func GetLocationByIp(secretKey, ip string, location *IPLocationData) error

Types

type IPLocation

type IPLocation struct {
	Code int            `json:"code"` //返回码 200成功
	Msg  string         `json:"msg"`  //返回消息
	Data IPLocationData `json:"data"`
}

type IPLocationData

type IPLocationData struct {
	AreaCode       string   `json:"area_code"`       //: "320311",
	Province       string   `json:"province"`        //省: "江苏",
	City           string   `json:"city"`            //: "徐州",
	District       string   `json:"district"`        //: "丰县",
	CityCode       string   `json:"city_code"`       //: "0516",
	Continent      string   `json:"continent"`       //: "亚洲",
	Country        string   `json:"country"`         //: "中国",
	CountryCode    string   `json:"country_code"`    //: "CN",
	CountryEnglish string   `json:"country_english"` //: "",
	Elevation      string   `json:"elevation"`       //: "40",
	Ip             string   `json:"ip"`              //: "114.234.76.140",
	Isp            string   `json:"isp"`             //: "电信",
	Latitude       string   `json:"latitude"`        //: "34.227883",
	LocalTime      string   `json:"local_time"`      //: "2023-08-02 14:36",
	Longitude      string   `json:"longitude"`       //: "117.213995",
	MultiStreet    []Street `json:"multi_street"`
	Street         string   `json:"street"`          //: "解放路168号",
	Version        string   `json:"version"`         //: "V4",
	WeatherStation string   `json:"weather_station"` //: "CHXX0437",
	ZipCode        string   `json:"zip_code"`        //: "221006"
}

type Street

type Street struct {
	Lng          string `json:"lng"`           //经度: "116.60833",
	Lat          string `json:"lat"`           //纬度: "34.701533",
	Province     string `json:"province"`      //省: "江苏",
	City         string `json:"city"`          //: "徐州",
	District     string `json:"district"`      //: "丰县",
	Street       string `json:"street"`        //: "解放路168号",
	StreetNumber string `json:"street_number"` //: "解放路168号"
}

Jump to

Keyboard shortcuts

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