Ciyfly / Ciyfly

README

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go的一些事例要学习下

Ciyfly opened this issue · comments

commented

优秀的go代码需要读源码
https://github.com/golang/groupcache

commented

对http层面的反向代理转发 可以使用 httputil 是go的内置原生库

参数go安全开发那边书 和网上链接
https://blog.csdn.net/idwtwt/article/details/52588762

https://blog.csdn.net/m0_47404181/article/details/107143075

https://blog.csdn.net/qq_38900565/article/details/107576610

https://github.com/golang/go/blob/master/src/net/http/httputil/reverseproxy_test.go

func (this *handle) ServeHTTP(w http.ResponseWriter, r *http.Request) {
		remote, err := url.Parse("http://127.0.0.1:443")
		if err != nil {
			panic(err)
		}
		proxy := httputil.NewSingleHostReverseProxy(remote)
		var pTransport http.RoundTripper = &http.Transport{
			Proxy:                 http.ProxyFromEnvironment,
			Dial:                  Dial,
			TLSHandshakeTimeout:   10 * time.Second,
			ExpectContinueTimeout: 1 * time.Second,
		}
		proxy.Transport = pTransport
 
		proxy.ServeHTTP(w,r)
}
commented

golang一个可以执行复杂sql的orm框架
https://github.com/uptrace/bun