-
Notifications
You must be signed in to change notification settings - Fork 125
feat(tun): support ipv6 on tun inbound #851
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
Conversation
Codecov ReportAttention: Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances TUN support by adding IPv6 configuration, addressing, and routing across platforms, and switches to the tun-rs crate for TUN device management.
- Introduce
gateway_v6inTunConfigand auto-configure IPv6 routes - Replace the legacy
tuncrate withtun-rsand refactor TUN initialization - Refactor network interface handling to use a richer
OutboundInterfacetype
Reviewed Changes
Copilot reviewed 41 out of 43 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/check_socks5.py | Add IPv6 DNS probe and validation in the SOCKS5 check script |
| clash-lib/src/config/internal/config.rs | Extend TunConfig with gateway_v6 support |
| clash-lib/src/app/net/mod.rs | Introduce OutboundInterface with IPv6 fields and helpers |
| clash-lib/src/proxy/utils/socket_helpers.rs | Update TCP/UDP socket helpers to select IPv6 sockets by interface |
| clash-lib/src/proxy/tun/routes/macos.rs | Add IPv6 route handling in macOS TUN route commands |
| clash-lib/src/app/logging.rs | Improve default log-level parsing fallback behavior |
Comments suppressed due to low confidence (2)
scripts/check_socks5.py:42
- The
return Trueis unconditionally executed and is not indented under the precedingif, causing the subsequentelseto be unmatched. Indent thereturn Trueinside theifblock or restructure the conditional to ensure theelsepairs correctly.
return True
clash-lib/src/proxy/utils/socket_helpers.rs:62
- Named placeholders
{iface:?}and{family:?}in adebug!format string without passing named arguments will not compile. Use positional placeholders and passifaceandfamilyas arguments, e.g.,"binding tcp socket to interface: {:?}, family: {:?}", iface, family.
debug!("binding tcp socket to interface: {iface:?}, family: {family:?}");
| } | ||
| } | ||
|
|
||
| if gateway_v4.is_none() { |
Copilot
AI
Jul 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error condition only checks for a missing IPv4 gateway and will fail even if an IPv6 gateway is present. Update the final check to if gateway_v4.is_none() && gateway_v6.is_none() so that success is allowed when either gateway exists.
| if gateway_v4.is_none() { | |
| if gateway_v4.is_none() && gateway_v6.is_none() { |
Co-authored-by: Copilot <[email protected]> Signed-off-by: Yuwei Ba <[email protected]>
🤔 This is a ...
🔗 Related issue link
#579
#847
#719
💡 Background and solution
use tun-rs from #719 (comment)
📝 Changelog
☑️ Self-Check before Merge