lifenjoiner / pd

pd is a local proxy dispatcher acting like auto-pac.
MIT License
30 stars 4 forks source link

CONNECT no valid proxy #1

Closed Zimong closed 1 year ago

Zimong commented 1 year ago
2023/09/13 03:36:29 pd v0.1.7 A local proxy dispatcher.
2023/09/13 03:36:29 [statichost] blocked: open blocked: The system cannot find the file specified.
2023/09/13 03:36:29 [statichost] direct: open direct: The system cannot find the file specified.
2023/09/13 03:36:29 [ProxyPool] socks5 updating ...
2023/09/13 03:36:29 [tcp] listening on 127.0.0.1:18080
2023/09/13 03:36:29 [dispatcher] We are online.
2023/09/13 03:36:29 [ProxyPool] Sorted latencies:
2023/09/13 03:36:29 [ProxyPool]  570.0917ms socks5://127.0.0.1:28080
2023/09/13 03:36:45 [http] GET http://detectportal.firefox.com/canonical.html <- 127.0.0.1:4474 [type:0]
2023/09/13 03:36:45 [http] direct:1/3 GET http://detectportal.firefox.com/canonical.html => 127.0.0.1:4474 <-> [2408:8256:5e80:2cbd:b9a9:7fe7:23fd:515f]:4476 <-> [2600:1901:0:38d7::]:80
2023/09/13 03:36:45 [http] GET http://detectportal.firefox.com/success.txt?ipv4 <- 127.0.0.1:4477 [type:0]
2023/09/13 03:36:45 [http] direct:1/3 GET http://detectportal.firefox.com/success.txt?ipv4 => 127.0.0.1:4477 <-> [2408:8256:5e80:2cbd:b9a9:7fe7:23fd:515f]:4479 <-> [2600:1901:0:38d7::]:80
2023/09/13 03:36:45 [http] POST http://ocsp.digicert.com/ <- 127.0.0.1:4481 [type:0]
2023/09/13 03:36:47 [http] CONNECT translate.google.com:443 <- 127.0.0.1:4484 [type:0]
2023/09/13 03:36:50 [http] direct:1/1 CONNECT translate.google.com:443 <= dial tcp 142.251.42.238:443: i/o timeout
2023/09/13 03:36:50 [http] proxy:1/3 CONNECT translate.google.com:443 <= no valid proxy
2023/09/13 03:36:50 [http] proxy:2/3 CONNECT translate.google.com:443 <= no valid proxy
2023/09/13 03:36:50 [http] proxy:3/3 CONNECT translate.google.com:443 <= no valid proxy

启动的时候 Sorted latencies: 570.0917ms socks5://127.0.0.1:28080 怎么到后面就 no valid proxy socks5://127.0.0.1:28080 在别的软件测试过是正常。

lifenjoiner commented 1 year ago

原因如 readme 所述:

使用相同协议的上游代理原始请求。

即不做代理协议的转换。


2023/09/13 03:36:47 [http] CONNECT translate.google.com:443 <- 127.0.0.1:4484 [type:0]
2023/09/13 03:36:50 [http] direct:1/1 CONNECT translate.google.com:443 <= dial tcp 142.251.42.238:443: i/o timeout
2023/09/13 03:36:50 [http] proxy:1/3 CONNECT translate.google.com:443 <= no valid proxy

表明,下游程序选择了 http 代理协议,而你没有提供上游 http 代理。


解决方案:

  1. 推荐,同时设置上游 http 代理和 socks5 代理,可多个。下游程序根据需要自己选择使用哪个协议。
  2. 或者,只给下游程序设置 socks5 代理,不设置 http(s) 代理。