圈圈套圈圈(4)(待续)

编程入门 行业动态 更新时间:2024-10-25 03:26:02

<a href=https://www.elefans.com/category/jswz/34/1720133.html style=圈圈套圈圈(4)(待续)"/>

圈圈套圈圈(4)(待续)

本地回路:

a. localhost https
b. 0. localhost http 当连接不到https时
c. proxy on localhost
通过(c)连接到(a). 当无法连接到(a)的时候测试是否可以连接到(b).

package mainimport ("fmt""log""net/http""net/http/httputil""time"
)func main() {rProxy := httputil.ReverseProxy{Director: func(req *http.Request) {log.Printf("request for %v", req.URL)},}mux := http.NewServeMux()mux.HandleFunc("/", func(rw http.ResponseWriter, req *http.Request) {rProxy.ServeHTTP(rw, req)})svr := http.Server{Addr:         ":9077",Handler:      mux,ReadTimeout:  30 * time.Second,WriteTimeout: 30 * time.Second,}res := svr.ListenAndServe()fmt.Printf("\n%v\n", res)
}

于是这里发现一个问题, 无法代理https.

就这个问题, 目前若从简,则需要借助goproxy来完成. (详细的https走CONNECT通道的代码尚未研究)
(待续)

以下是没有代理, 测试服务器是否就位。

curl -sL http://localhost:4000
curl --insecure -sL https://localhost
curl --insecure -sL https://localhost:443

更多推荐

圈圈套圈圈(4)(待续)

本文发布于:2024-03-08 06:58:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1720134.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:圈圈   套圈

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!