|
|
|
@ -128,6 +128,36 @@ func (h *HTTPBin) IP(w http.ResponseWriter, r *http.Request) {
|
|
|
|
writeJSON(w, body, http.StatusOK)
|
|
|
|
writeJSON(w, body, http.StatusOK)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (h *HTTPBin) IP1(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
|
|
|
ret := models.Ret{Data: []string{}}
|
|
|
|
|
|
|
|
ret.Ret = "ok"
|
|
|
|
|
|
|
|
ret.Ip = ""
|
|
|
|
|
|
|
|
origin := getOrigin(r)
|
|
|
|
|
|
|
|
if len(origin) > 0 {
|
|
|
|
|
|
|
|
ipArray := strings.Split(origin, ":")
|
|
|
|
|
|
|
|
if len(ipArray) > 1 {
|
|
|
|
|
|
|
|
ret.Ip = ipArray[0]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
body, _ := json.Marshal(ret)
|
|
|
|
|
|
|
|
writeJSON(w, body, http.StatusOK)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (h *HTTPBin) IP2(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
|
|
|
ret := models.Ret{Data: []string{}}
|
|
|
|
|
|
|
|
ret.Ret = "ok"
|
|
|
|
|
|
|
|
ret.Ip = ""
|
|
|
|
|
|
|
|
origin := getOrigin(r)
|
|
|
|
|
|
|
|
if len(origin) > 0 {
|
|
|
|
|
|
|
|
ipArray := strings.Split(origin, ":")
|
|
|
|
|
|
|
|
if len(ipArray) > 1 {
|
|
|
|
|
|
|
|
ret.Ip = ipArray[0]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
body, _ := json.Marshal(ret)
|
|
|
|
|
|
|
|
writeJSON(w, body, http.StatusOK)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (h *HTTPBin) IP10(w http.ResponseWriter, r *http.Request) {
|
|
|
|
func (h *HTTPBin) IP10(w http.ResponseWriter, r *http.Request) {
|
|
|
|
cmip := models.QueryIp10()
|
|
|
|
cmip := models.QueryIp10()
|
|
|
|
ret := models.Ret{Data: []string{}}
|
|
|
|
ret := models.Ret{Data: []string{}}
|
|
|
|
|