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

开启fastOpen后在ipv4 only的环境下,域名解析只会返回ipv6地址,mode auto没有生效 #1308

Open
XxyokixX opened this issue Feb 5, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@XxyokixX
Copy link

XxyokixX commented Feb 5, 2025

描述问题

当ipv4 only的机器在outbound type: directfastOpen的值设置为true 而且此时modeauto时,proxy将不会正常工作

观察日志看出,发现解析出的域名是ipv6地址,并没有ipv4地址,可我只有ipv4地址,此时会提示网络不可达

2025-02-05T13:32:17+08:00       INFO    server mode
2025-02-05T13:32:17+08:00       INFO    traffic stats server up and running     {"listen": "127.0.0.1:48336"}
2025-02-05T13:32:17+08:00       INFO    server up and running   {"listen": ":45458"}
2025-02-05T13:32:17+08:00       INFO    masquerade HTTPS server up and running  {"listen": ":45458"}
2025-02-05T13:35:15+08:00       INFO    client connected        {"addr": "1.2.3.4:44095", "id": "user", "tx": 27500000}
2025-02-05T13:35:15+08:00       WARN    TCP error       {"addr": "1.2.3.4:44095", "id": "user", "reqAddr": "www.google.com:443", "error": "dial tcp6 [2404:6800:4012:7::2004]:443: connect: network is unreachable"}
2025-02-05T13:35:15+08:00       WARN    TCP error       {"addr": "1.2.3.4:44095", "id": "user", "reqAddr": "api.hy2.io:443", "error": "dial tcp6 [2606:4700:3037::ac43:d0f6]:443: connect: network is unreachable"}

如何复现

outbound配置如下就会触发这个bug

outbounds:
  - name: hihy
    type: direct
    direct:
      mode: auto
      fastOpen: true
  - name: v4_only
    type: direct
    direct:
      mode: 4
      fastOpen: true
  - name: v6_only
    type: direct
    direct:
      mode: 6
      fastOpen: true

  - name: hihy
    type: direct
    direct:
      mode: auto
      fastOpen: true

mode修改成46 ipv4优先,此时不会出错:

  - name: hihy
    type: direct
    direct:
      mode: 46
      fastOpen: true

或者关闭fastOpen后域名,auto将成功返回ipv4地址,也不会出错

  - name: hihy
    type: direct
    direct:
      mode: auto
      fastOpen: false

虽然由上的实验,不应该是其他配置的问题,姑且放上完整server config 以及 client config

listen: :45458
auth:
  type: password
  password: b3407d35-8359-4cc3-9d30-ed5f9fcecd44
quic:
  initStreamReceiveWindow: 10560000
  maxStreamReceiveWindow: 15840000
  initConnReceiveWindow: 26400000
  maxConnReceiveWindow: 39600000
  maxIdleTimeout: 30s
  maxIncomingStreams: 1024
  disablePathMTUDiscovery: false
bandwidth:
  up: 220mbps
  down: 55mbps
acl:
  file: /etc/hihy/acl/acl.txt
masquerade:
  type: string
  string:
    content: HelloWorld
    headers:
      content-type: text/plain
      custom-stuff: HelloWorld
    statusCode: 200
  listenHTTPS: :45458
speedTest: true
tls:
  cert: /etc/hihy/cert/helloworld.com.crt
  key: /etc/hihy/cert/helloworld.com.key
  sniGuard: strict
outbounds:
  - name: hihy
    type: direct
    direct:
      mode: auto
      fastOpen: true
  - name: v4_only
    type: direct
    direct:
      mode: 4
      fastOpen: true
  - name: v6_only
    type: direct
    direct:
      mode: 6
      fastOpen: true
trafficStats:
  listen: 127.0.0.1:48336
  secret: b3407d35-8359-4cc3-9d30-ed5f9fcecd44

server: hysteria2://[email protected]:45458,47000-48000/
tls:
  sni: helloworld.com
  insecure: true
transport:
  type: udp
  udp:
    hopInterval: 120s
quic:
  initStreamReceiveWindow: 10560000
  initConnReceiveWindow: 26400000
  maxConnReceiveWindow: 39600000
  maxStreamReceiveWindow: 15840000
  keepAlivePeriod: 60s
bandwidth:
  down: 220mbps
  up: 55mbps
fastOpen: true
lazy: true
socks5:
  listen: 127.0.0.1:20808

预期行为

希望开启fastOpenmode: auto可以正常工作

日志

localhost:~# hihy 14
-> 14) 查看实时日志 
2025-02-05T13:32:17+08:00       INFO    server mode
2025-02-05T13:32:17+08:00       INFO    traffic stats server up and running     {"listen": "127.0.0.1:48336"}
2025-02-05T13:32:17+08:00       INFO    server up and running   {"listen": ":45458"}
2025-02-05T13:32:17+08:00       INFO    masquerade HTTPS server up and running  {"listen": ":45458"}
2025-02-05T13:35:15+08:00       INFO    client connected        {"addr": "1.2.3.4:44095", "id": "user", "tx": 27500000}
2025-02-05T13:35:15+08:00       WARN    TCP error       {"addr": "1.2.3.4:44095", "id": "user", "reqAddr": "www.google.com:443", "error": "dial tcp6 [2404:6800:4012:7::2004]:443: connect: network is unreachable"}
2025-02-05T13:35:15+08:00       WARN    TCP error       {"addr": "1.2.3.4:44095", "id": "user", "reqAddr": "api.hy2.io:443", "error": "dial tcp6 [2606:4700:3037::ac43:d0f6]:443: connect: network is unreachable"}

设备和操作系统
我在多台ipv4 only的服务器上都复现了这个bug,因此可以排除是我机器的问题,测试环境包括debian和alpine

额外信息

如果需要额外信息可以再次补充

@XxyokixX XxyokixX added the bug Something isn't working label Feb 5, 2025
emptysuns added a commit to emptysuns/Hi_Hysteria that referenced this issue Feb 5, 2025
…n't resolving ipv4 address of domain

[暂行] 默认关闭fastOpen, 不然在auto模式下有bug,不解析域名的ipv4地址

apernet/hysteria#1308
@haruue haruue self-assigned this Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants