ws和wss的path参数url解码后发送
http代理connect方法支持host参数自定义 Proxy-Agent修改为nginx
This commit is contained in:
8
http.go
8
http.go
@ -52,6 +52,10 @@ func (c *httpConnector) ConnectContext(ctx context.Context, conn net.Conn, netwo
|
||||
ua = DefaultUserAgent
|
||||
}
|
||||
|
||||
if opts.Host != "" {
|
||||
address = opts.Host
|
||||
}
|
||||
|
||||
conn.SetDeadline(time.Now().Add(timeout))
|
||||
defer conn.SetDeadline(time.Time{})
|
||||
|
||||
@ -182,7 +186,7 @@ func (h *httpHandler) handleRequest(conn net.Conn, req *http.Request) {
|
||||
ProtoMinor: 1,
|
||||
Header: http.Header{},
|
||||
}
|
||||
resp.Header.Add("Proxy-Agent", "gost/"+Version)
|
||||
resp.Header.Add("Proxy-Agent", ProxyAgent)
|
||||
|
||||
if !Can("tcp", host, h.options.Whitelist, h.options.Blacklist) {
|
||||
log.Logf("[http] %s - %s : Unauthorized to tcp connect to %s",
|
||||
@ -296,7 +300,7 @@ func (h *httpHandler) handleRequest(conn net.Conn, req *http.Request) {
|
||||
|
||||
if req.Method == http.MethodConnect {
|
||||
b := []byte("HTTP/1.1 200 Connection established\r\n" +
|
||||
"Proxy-Agent: gost/" + Version + "\r\n\r\n")
|
||||
"Proxy-Agent: " + ProxyAgent + "\r\n\r\n")
|
||||
if Debug {
|
||||
log.Logf("[http] %s <- %s\n%s", conn.RemoteAddr(), conn.LocalAddr(), string(b))
|
||||
}
|
||||
|
Reference in New Issue
Block a user