TUN inbound: Warn about forwarding on the outbound interface instead of refusing to start

Mobile Hotspot may well be on before the TUN starts, and having it share
the TUN instead of the physical interface then moves forwarding off it, but
the TUN can only be picked to share while it runs. So the TUN starts, with a
warning that says so, and Xray's own connections recover once forwarding
goes off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
patterniha
2026-10-05 16:12:47 +03:30
co-authored by Claude Opus 5.5
parent b71975abed
commit 46d49adc5c
3 changed files with 6 additions and 8 deletions
+4 -4
View File
@@ -75,13 +75,13 @@ func (g *outboundGuard) check() string {
}
}
if len(forwarding) > 0 {
return "forwarding is on for " + strings.Join(forwarding, " and ") + " on " + name + " (Mobile Hotspot and Internet Connection Sharing turn it on), so Windows ignores autoOutboundsInterface there, and Xray's own connections go into the TUN and stall"
return "forwarding is on for " + strings.Join(forwarding, " and ") + " on " + name + " (Mobile Hotspot and Internet Connection Sharing turn it on), so Windows ignores autoOutboundsInterface there, and Xray's own connections go into the TUN and stall: turn the hotspot off, or have it share the TUN instead of " + name
}
return ""
}
// recheck is check for a running TUN, which logs a forwarding problem when it
// comes up. (Windows may turn forwarding on and off a few times meanwhile.)
// recheck runs check, and warns about forwarding when it comes up. (Windows
// may turn forwarding on and off a few times meanwhile.)
func (g *outboundGuard) recheck() {
problem := g.check()
g.Lock()
@@ -89,7 +89,7 @@ func (g *outboundGuard) recheck() {
g.reported = problem
g.Unlock()
if cameUp {
errors.LogError(context.Background(), "[tun] ", problem)
errors.LogWarning(context.Background(), "[tun] ", problem)
}
}