Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

上级代理为 https 的转发代理可用,但上级代理为 http2/h2 的转发代理不可用。 #181

Closed
jerry-wolf opened this issue Nov 7, 2017 · 4 comments

Comments

@jerry-wolf
Copy link

jerry-wolf commented Nov 7, 2017

服务端为 Caddy 的 forwardproxy 插件,未开启 probe_resistance ,直接在浏览器设置代理可正常工作,且可以在 chrome://net-internals/#http2 看到使用了 HTTP/2。
执行 .\gost.exe -L=:8080 -F=https://user:[email protected]:443 -D
然后将浏览器的 HTTP 代理设为 127.0.0.1:8080 后,正常访问。

2017/11/08 04:42:41 http.go:98: [http] 127.0.0.1:11281 -> github.com:443
CONNECT github.com:443 HTTP/1.1
Host: github.com:443
Proxy-Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3253.3 Safari/5
37.36

2017/11/08 04:42:41 http.go:52: CONNECT / HTTP/1.1
Host: github.com:443
Proxy-Authorization: Basic *** Hidden ***
Proxy-Connection: keep-alive
User-Agent: Chrome/60.0.3112.90


2017/11/08 04:42:42 http.go:62: HTTP/1.1 200 OK
Server: Caddy
Content-Length: 0


2017/11/08 04:42:42 http.go:167: [http] 127.0.0.1:11281 <- github.com:443
HTTP/1.1 200 Connection established
Proxy-Agent: gost/2.4

2017/11/08 04:42:42 http.go:179: [http] 192.168.10.100:11282 <-> github.com:443

然而,如果执行 .\gost.exe -L=:8080 -F=http2://user:[email protected]:443 -D ,浏览器连接超时(ERR_TIMED_OUT)

2017/11/08 04:49:12 http.go:98: [http] 127.0.0.1:11432 -> github.com:443
CONNECT github.com:443 HTTP/1.1
Host: github.com:443
Proxy-Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3253.3 Safari/5
37.36

2017/11/08 04:49:12 http2.go:58: [http2] CONNECT / HTTP/2.0
Host: myserver.com:443
Gost-Target: github.com:443
Proxy-Authorization: Basic *** Hidden ***


2017/11/08 04:49:13 http2.go:66: [http2] HTTP/2.0 200 OK
Content-Type: text/plain; charset=utf-8
Date: Tue, 07 Nov 2017 20:49:15 GMT
Server: Caddy
Vary: Accept-Encoding


2017/11/08 04:49:14 http.go:167: [http] 127.0.0.1:11432 <- github.com:443
HTTP/1.1 200 Connection established
Proxy-Agent: gost/2.4

2017/11/08 04:49:14 http.go:179: [http] 45.76.78.173:443 <-> github.com:443
2017/11/08 04:49:44 http.go:181: [http] 45.76.78.173:443 >-< github.com:443
2017/11/08 04:49:44 http.go:98: [http] 127.0.0.1:11442 -> github.com:443
CONNECT github.com:443 HTTP/1.1
Host: github.com:443
Proxy-Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3253.3 Safari/5
37.36

2017/11/08 04:49:44 http2.go:58: [http2] CONNECT / HTTP/2.0
Host: myserver.com:443
Gost-Target: github.com:443
Proxy-Authorization: Basic *** Hidden ***


2017/11/08 04:49:44 http2.go:66: [http2] HTTP/2.0 200 OK
Content-Type: text/plain; charset=utf-8
Date: Tue, 07 Nov 2017 20:49:46 GMT
Server: Caddy
Vary: Accept-Encoding


2017/11/08 04:49:44 http.go:167: [http] 127.0.0.1:11442 <- github.com:443
HTTP/1.1 200 Connection established
Proxy-Agent: gost/2.4

2017/11/08 04:49:44 http.go:179: [http] 45.76.78.173:443 <-> github.com:443
2017/11/08 04:50:14 http.go:181: [http] 45.76.78.173:443 >-< github.com:443

如果执行 .\gost.exe -L=:8080 -F=h2://user:[email protected]:443 -D ,浏览器连接超时(ERR_TIMED_OUT)

2017/11/08 04:54:54 http.go:98: [http] 127.0.0.1:11528 -> github.com:443
CONNECT github.com:443 HTTP/1.1
Host: github.com:443
Proxy-Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3253.3 Safari/5
37.36

2017/11/08 04:54:54 http2.go:210: [http2] CONNECT / HTTP/2.0
Host: myserver.com:443


2017/11/08 04:54:55 http2.go:218: [http2] HTTP/2.0 404 Not Found
Content-Type: text/plain; charset=utf-8
Date: Tue, 07 Nov 2017 20:54:56 GMT
Server: Caddy
Vary: Accept-Encoding
X-Content-Type-Options: nosniff


2017/11/08 04:54:55 http.go:151: [http] 127.0.0.1:11528 -> github.com:443 : 404 Not Found
2017/11/08 04:54:55 http.go:156: [http] 127.0.0.1:11528 <- github.com:443
HTTP/1.1 503 Service unavailable
Proxy-Agent: gost/2.4

2017/11/08 04:54:55 http.go:98: [http] 127.0.0.1:11530 -> github.com:443
CONNECT github.com:443 HTTP/1.1
Host: github.com:443
Proxy-Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3253.3 Safari/5
37.36

2017/11/08 04:54:55 http2.go:210: [http2] CONNECT / HTTP/2.0
Host: myserver.com:443


2017/11/08 04:54:55 http2.go:218: [http2] HTTP/2.0 404 Not Found
Content-Type: text/plain; charset=utf-8
Date: Tue, 07 Nov 2017 20:54:57 GMT
Server: Caddy
Vary: Accept-Encoding
X-Content-Type-Options: nosniff


2017/11/08 04:54:55 http.go:151: [http] 127.0.0.1:11530 -> github.com:443 : 404 Not Found
2017/11/08 04:54:55 http.go:156: [http] 127.0.0.1:11530 <- github.com:443
HTTP/1.1 503 Service unavailable
Proxy-Agent: gost/2.4

2017/11/08 04:55:00 http.go:98: [http] 127.0.0.1:11533 -> github.com:443
CONNECT github.com:443 HTTP/1.1
Host: github.com:443
Proxy-Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3253.3 Safari/5
37.36

2017/11/08 04:55:00 http2.go:210: [http2] CONNECT / HTTP/2.0
Host: myserver.com:443
@ginuerzh
Copy link
Owner

ginuerzh commented Nov 8, 2017

在之前的Go版本当中,测试时发现客户端无法发送标准的CONNECT代理请求,所以HTTP2模式的客户端使用了一种自定义的特殊方式:在HTTP请求头中使用Gost-Target头来指定目标地址。所以是与标准的HTTP2服务端是不兼容的。

@humiaozuzu
Copy link

@ginuerzh 您好,不知道现在版本的 go 能不能支持标准的 CONNECT 代理请求呢?谢谢

@kdrx
Copy link

kdrx commented Aug 6, 2018

@ginuerzh 希望客户端能兼容标准http2代理

@ginuerzh
Copy link
Owner

ginuerzh commented Nov 23, 2018

golang/go#17227 在下个Go版本1.12中或许可以实现

@ginuerzh ginuerzh added this to the 2.8 milestone Mar 12, 2019
hktalent pushed a commit to hktalent/gost that referenced this issue Oct 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants