From 0fb1231829aec315bae76f782f63ae5d3a609be6 Mon Sep 17 00:00:00 2001 From: wenfei Date: Tue, 9 Sep 2025 13:49:28 +0800 Subject: [PATCH] add pack --- beepack.sh | 22 ++++++++++++++++++++++ httpbin/handlers.go | 14 ++++++++++++++ httpbin/httpbin.go | 3 ++- 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 beepack.sh diff --git a/beepack.sh b/beepack.sh new file mode 100644 index 0000000..3100671 --- /dev/null +++ b/beepack.sh @@ -0,0 +1,22 @@ +#交叉编译打包不同平台的安装包 + +#linux +bee pack -be GOOSlinux GOARCH=amd64 +或 +bee pack -be GOOS=linux GOARCH=amd64 + +#windows +bee pack -be GOOSwindows GOARCH=amd64 +或 +bee pack -be GOOS=windows GOARCH=amd64 + +#go build打包方式 +GOOS=windows GOARCH=amd64 go build + +GOOS=freebsd GOARCH=amd64 go build + +GOOS=linux GOARCH=amd64 go build + +GOOS=linux GOARCH=arm64 go build + +GOOS=darwin GOARCH=amd64 go build \ No newline at end of file diff --git a/httpbin/handlers.go b/httpbin/handlers.go index 7c4ce41..e528464 100644 --- a/httpbin/handlers.go +++ b/httpbin/handlers.go @@ -137,6 +137,20 @@ func (h *HTTPBin) IP10(w http.ResponseWriter, r *http.Request) { 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) + body := []byte(result) + writeJSON(w, body, http.StatusOK) +} + +func (h *HTTPBin) Sftp(w http.ResponseWriter, r *http.Request) { + cmip := models.QueryIp10() + result := fmt.Sprintf("sftp -P 221 root@%s",cmip.Ip) + body := []byte(result) + writeJSON(w, body, http.StatusOK) +} + // UserAgent echoes the incoming User-Agent header func (h *HTTPBin) UserAgent(w http.ResponseWriter, r *http.Request) { body, _ := json.Marshal(&userAgentResponse{ diff --git a/httpbin/httpbin.go b/httpbin/httpbin.go index 9ea43d0..ef9c6ab 100644 --- a/httpbin/httpbin.go +++ b/httpbin/httpbin.go @@ -132,12 +132,13 @@ func (h *HTTPBin) Handler() http.Handler { mux.HandleFunc("/ip", h.IP) mux.HandleFunc("/ip10", h.IP10) + mux.HandleFunc("/ssh", h.Ssh) + mux.HandleFunc("/sftp", h.Sftp) mux.HandleFunc("/user-agent", h.UserAgent) mux.HandleFunc("/headers", h.Headers) mux.HandleFunc("/response-headers", h.ResponseHeaders) mux.HandleFunc("/status/", h.Status) - mux.HandleFunc("/redirect/", h.Redirect) mux.HandleFunc("/relative-redirect/", h.RelativeRedirect) mux.HandleFunc("/absolute-redirect/", h.AbsoluteRedirect)