|
|
|
|
@ -20,6 +20,7 @@ func IPHandle(w http.ResponseWriter, req *http.Request) {
|
|
|
|
|
address := req.FormValue("address")
|
|
|
|
|
addressType := ""
|
|
|
|
|
ipDomain := ""
|
|
|
|
|
domain := ""
|
|
|
|
|
switch {
|
|
|
|
|
case address == "":
|
|
|
|
|
//没传address值 则拿请求ip来查询
|
|
|
|
|
@ -39,6 +40,7 @@ func IPHandle(w http.ResponseWriter, req *http.Request) {
|
|
|
|
|
addressType = "self"
|
|
|
|
|
} else {
|
|
|
|
|
//提供正确域名 则查询ip
|
|
|
|
|
domain = address
|
|
|
|
|
ipDomain = ipAddress
|
|
|
|
|
address = ipAddress
|
|
|
|
|
addressType = "domain"
|
|
|
|
|
@ -52,7 +54,7 @@ func IPHandle(w http.ResponseWriter, req *http.Request) {
|
|
|
|
|
ipInfo.Domain = ""
|
|
|
|
|
case "domain":
|
|
|
|
|
ipInfo.IP = ipDomain
|
|
|
|
|
ipInfo.Domain = address
|
|
|
|
|
ipInfo.Domain = domain
|
|
|
|
|
case "self":
|
|
|
|
|
ipInfo.IP = address
|
|
|
|
|
ipInfo.Domain = ""
|
|
|
|
|
|