fix: auto-detect TUN and add direct route for proxy#29
Open
fix: auto-detect TUN and add direct route for proxy#29
Conversation
Reimplementation of #24 on current master. Wrapper (templates.sh): - Detect TUN on every claude launch (utun count on macOS, tun0 on Linux) - Check if proxy IP has direct route via physical gateway - Auto-add /32 host route if missing (delete-then-add for TUN entries) Check (cmd_check.sh): - Replace relay connectivity test with route check - Auto-fix missing route on check (may need sudo) Relay (cmd_relay.sh): - Add _relay_route_ok / _relay_ensure_route helpers - Improve _relay_add_route: delete existing route before adding - Remove legacy cmd_relay user command (relay is now fully automatic) relay.js: - Add debug logging for CONNECT, errors, and 502 responses
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reimplementation of #24 on current master (original had unresolvable conflicts).
What it does
When a proxy is configured and TUN is active (Clash/sing-box/etc), the proxy connection gets hijacked by the TUN tunnel, creating a routing loop. This PR auto-detects TUN and adds a direct host route for the proxy IP.
Changes
Wrapper — on every
claudelaunch:Check —
cac env check:Relay — internal functions:
_relay_route_ok/_relay_ensure_routehelpers_relay_add_routenow deletes existing route before adding (handles TUN-created entries)cmd_relayuser command (relay is fully automatic)relay.js — debug logging for CONNECT, errors, 502
Replaces #24