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

[BUG] Sniffer 关闭 override-destination 后导致 SOCKS 5 代理错误 #376

Closed
Hill-98 opened this issue Feb 7, 2023 · 4 comments
Closed

Comments

@Hill-98
Copy link

Hill-98 commented Feb 7, 2023

我本地运行了一个 Tor 客户端,然后在 Clash 里配置了一个 SOCKS 5 代理连接到 Tor 客户端,但是设置 override-destination: false 后,Tor 会报以下错误:

Feb 08 03:38:06.000 [info] connection_handle_listener_read(): New SOCKS connection opened from 10.10.10.1.
Feb 08 03:38:06.000 [warn] Your application (using socks5 to port 443) gave Tor a malformed hostname: [scrubbed]. Rejecting the connection.
@Hill-98 Hill-98 changed the title [BUG] Sniffer 开启 override-destination 后导致 SOCKS 5 代理错误 [BUG] Sniffer 关闭 override-destination 后导致 SOCKS 5 代理错误 Feb 7, 2023
@Hill-98
Copy link
Author

Hill-98 commented Feb 18, 2023

这是我捕获的数据包文件,里面分别有开启和关闭 override-destination 的 pcapng 文件:
override-destination.zip

关闭 override-destination 后,SOCKS 数据包的 Remote name 字段为空,我觉得关闭 override-destination 后应该将 SOCKS 数据包的 Address Type 设置为 IPv4 address (0x01) 或 IPv6 address (0x04),而不是 Domain name (0x03),然后把 Remote Name 设置为 IP 地址。

测试命令: curl -x socks://127.0.0.1:7890 http://www.gstatic.com/generate_204

测试配置文件:

allow-lan: false
bind-address: 127.0.0.1
external-controller: 127.0.0.1:9090
geodata-mode: true
ipv6: true
log-level: info
mixed-port: 7890
mode: rule
tcp-concurrent: false

dns:
  default-nameserver:
    - 119.29.29.29
    - 223.5.5.5
  enable: true
  enhanced-mode: redir-host
  fallback:
    - https://1.1.1.1/dns-query
  fallback-filter:
    geoip: true
    geoip-code: CN
  ipv6: true
  listen: 0.0.0.0:9053
  nameserver:
    - https://120.53.53.53/dns-query
  use-hosts: true
  proxy-server-nameserver:
    - https://120.53.53.53/dns-query
profile:
  store-selected: true
  store-fake-ip: true
sniffer:
  enable: true
  override-destination: false # or true
  sniff:
    TLS:
      ports:
        - 443
    HTTP:
      ports:
        - 80
  sniffing:
    - http
    - tls
proxies:
  - name: 洋葱网络
    type: socks5
    server: 10.10.10.1
    port: 9123
    udp: true
rules:
  - MATCH,洋葱网络

@Hill-98
Copy link
Author

Hill-98 commented Feb 18, 2023

不过无论开启还是关闭 override-destination,如果用 HTTP 入站是没问题的,比如: curl -x http://127.0.0.1:7890 http://www.gstatic.com/generate_204,不过 HTTP 代理本身就是只支持域名。

Skyxim added a commit that referenced this issue Feb 18, 2023
@Skyxim
Copy link
Collaborator

Skyxim commented Feb 18, 2023

@Hill-98 已经修复了,正在编译

@Hill-98
Copy link
Author

Hill-98 commented Feb 18, 2023

没问题了

@Hill-98 Hill-98 closed this as completed Feb 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants