main
wenfei 3 months ago
parent b5fd13a20d
commit 6040c359c0

@ -17,7 +17,7 @@ import (
)
const defaultHost = "0.0.0.0"
const defaultPort = 8080
const defaultPort = 8088
var (
host string

@ -137,6 +137,16 @@ func (h *HTTPBin) IP10(w http.ResponseWriter, r *http.Request) {
writeJSON(w, body, http.StatusOK)
}
func (h *HTTPBin) IP20(w http.ResponseWriter, r *http.Request) {
cmip := models.QueryIp10()
ret := models.Ret20{Data: []string{}}
ret.Ret = "ok"
ret.Ip = cmip.Ip
ret.Updatetime = cmip.Updatetime
body, _ := json.Marshal(ret)
writeJSON(w, body, http.StatusOK)
}
func (h *HTTPBin) Ssh(w http.ResponseWriter, r *http.Request) {
cmip := models.QueryIp10()
result := fmt.Sprintf("ssh -p 221 root@%s",cmip.Ip)

@ -132,6 +132,7 @@ func (h *HTTPBin) Handler() http.Handler {
mux.HandleFunc("/ip", h.IP)
mux.HandleFunc("/ip10", h.IP10)
mux.HandleFunc("/ip20", h.IP20)
mux.HandleFunc("/ssh", h.Ssh)
mux.HandleFunc("/sftp", h.Sftp)
mux.HandleFunc("/user-agent", h.UserAgent)

@ -8,4 +8,11 @@ type Ret struct {
Ret string `json:"ret"`
Ip string `json:"ip"`
Data []string `json:"data"`
}
}
type Ret20 struct {
Ret string `json:"ret"`
Ip string `json:"ip"`
Updatetime string `json:"updatetime"`
Data []string `json:"data"`
}

Loading…
Cancel
Save