package ip import ( "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" ) type IpInfo struct { Ip string `json:"ip"` City string `json:"city"` Province string `json:"province"` Country string `json:"country"` Isp string `json:"isp"` Owner string `json:"owner"` Continent string `json:"continent"` Accuracy string `json:"accuracy"` Adcode string `json:"adcode"` Areacode string `json:"areacode"` Asnumber string `json:"asnumber"` Radius string `json:"radius"` Latwgs string `json:"latwgs"` Lngwgs string `json:"lngwgs"` Source string `json:"source"` Timezone string `json:"timezone"` Zipcode string `json:"zipcode"` District string `json:"district"` } // IpsParam // 单个ip请求参数 type IpParam struct { Ip string `json:"ip"` } type IpRequest struct { *requests.JsonRequest Ip string `position:"Json" field:"ip"` } // IpResponse // 单个ip返回参数 type IpResponse struct { *responses.BaseResponse Code int `json:"code"` Msg string `json:"msg"` Data IpInfo `json:"data"` } // CreateIpRequest // 同时支持ipv4、ipv6格式查询 func CreateIpRequest(param IpParam) (req *IpRequest) { req = &IpRequest{ JsonRequest: &requests.JsonRequest{}, Ip: param.Ip, } req.InitWithApiInfo(HOST, VERSION, "/v1/getIp") req.Method = requests.POST return } func CreateIpResponse() (resp *IpResponse) { resp = &IpResponse{ BaseResponse: &responses.BaseResponse{}, } return } // 多个ip请求参数 type IpsParam struct { Ips []string `json:"ips"` } type IpsRequest struct { *requests.JsonRequest Ips []string `position:"Json" field:"ips"` } // IpsResponse // 多个ip返回参数 type IpsResponse struct { *responses.BaseResponse Code int `json:"code"` Msg string `json:"msg"` Data map[string]IpInfo `json:"data"` } // CreateIpsRequest // 同时支持ipv4、ipv6格式查询 func CreateIpsRequest(param IpsParam) (req *IpsRequest) { req = &IpsRequest{ JsonRequest: &requests.JsonRequest{}, Ips: param.Ips, } req.InitWithApiInfo(HOST, VERSION, "/v1/getIps") req.Method = requests.POST return } func CreateIpsResponse() (resp *IpsResponse) { resp = &IpsResponse{ BaseResponse: &responses.BaseResponse{}, } return }