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

[Feature] Support dual stack fallback #83

Open
huyz-git opened this issue Dec 9, 2021 · 2 comments
Open

[Feature] Support dual stack fallback #83

huyz-git opened this issue Dec 9, 2021 · 2 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@huyz-git
Copy link

huyz-git commented Dec 9, 2021

Is your feature request related to a problem?
目前 tun2socks 支持 双栈 ip 地址,但却不支持 双栈 ip fallback,具体表现为,当配置 双栈 ip 之后,如果本地路由配置是 ipv6 优先,但某个网站的 ipv6 地址无法连接(上游不支持 ipv6 ,或者网站本身 ipv6 坏了),这个网站就无法开启,浏览器不会 fallback 到 ipv4 。

复现可以使用 https://ipv6-test.com/ 网站,用 direct:// 作为上游即可。

# 假设物理网卡为 eth0,有双栈 ip
tun2socks -device tun://tun0 -proxy direct:// -interface eth0
ip addr add 10.0.0.1/24 dev tun0
ip -6 addr add 2001:db8::1/64 dev tun0
ip link set dev tun0 up
ip route add default dev tun0
ip -6 route add default dev tun0

看右边的 Default 和 Fallback 项。
这个网站测试 Fallback 使用的域名是 http://fallback-v6.ipv6-test.comhttp://fallback-v4.ipv6-test.com ,这两个域名都有双栈解析,但其中一栈对应的 ip 的 80 端口是个黑洞,浏览器必须能够 fallback 到另一栈才能正常访问。

Describe the solution you'd like
不太确定这个功能技术上能否实现。
想要实现这个功能,需要改变建立连接的机制,必须当上游建立连接成功,并开始传输数据之后,下游才能建立连接,当上游建立连接 失败,下游则不建立连接。此时,浏览器会 fallback 到别的地址。
现在的 tun2socks 的机制是,下游发起连接之后,tun2socks 就立即和下游建立连接,然后才去连接上游,当上游建立连接失败,下游建立的连接就关闭。此时,由于下游的连接是已经正常建立并关闭的,浏览器就不会再去 fallback 到别的地址。

Describe alternatives you've considered

Additional context

@xjasonlyu
Copy link
Owner

必须当上游建立连接成功,并开始传输数据之后,下游才能建立连接,当上游建立连接 失败,下游则不建立连接

我没有理解,上游建立连接成功,并开始传输数据之后,下游才能建立连接,但没有下游的数据那这个数据是哪里来的?

现在的 tun2socks 的机制是,下游发起连接之后,tun2socks 就立即和下游建立连接,然后才去连接上游,当上游建立连接失败,下游建立的连接就关闭。此时,由于下游的连接是已经正常建立并关闭的,浏览器就不会再去 fallback 到别的地址。

嗯对,这应该是个问题,所以这好像更像是个issue?

@xjasonlyu xjasonlyu added the enhancement New feature or request label Dec 9, 2021
@xjasonlyu xjasonlyu added bug Something isn't working and removed enhancement New feature or request labels Dec 17, 2021
@github-actions github-actions bot added the Stale label Feb 15, 2022
@xjasonlyu xjasonlyu removed the Stale label Feb 15, 2022
@yydxwz
Copy link

yydxwz commented May 5, 2022

这个问题还没解决吧?

@github-actions github-actions bot added the Stale label Jul 4, 2022
@xjasonlyu xjasonlyu removed the Stale label Feb 12, 2023
@xjasonlyu xjasonlyu reopened this Feb 12, 2023
Repository owner deleted a comment from github-actions bot Mar 17, 2023
Repository owner deleted a comment from github-actions bot Mar 17, 2023
@xjasonlyu xjasonlyu pinned this issue May 17, 2023
@xjasonlyu xjasonlyu changed the title [Feature request] Support dual stack fallback [Feature] Support dual stack fallback Jul 16, 2024
@xjasonlyu xjasonlyu added the enhancement New feature or request label Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants