mirror of
https://github.com/2dust/v2rayN.git
synced 2026-09-30 10:32:07 +03:00
64aad8027a
#9930 made the Xray TUN inbound always request ::/0 in autoSystemRoutingTable so that IPv6 stops bypassing the tunnel. That only helps a host which actually holds a globally routable IPv6 address. On any other host it does harm. With IPv6 disabled the TUN device gets no IPv6 address at all, the kernel rejects the route with EACCES and the whole inbound fails to start: Failed to start: app/proxyman/inbound: failed to start proxy > proxy/tun: failed to add system route ::/0 > permission denied With IPv6 enabled but no global address the route is accepted and the host gains an IPv6 default route it cannot use. The TUN completes the TCP handshake locally before dialing the outbound, so IPv6 destinations start to look reachable and get picked, and the connection then dies at the outbound instead of failing fast (#10051). Neither host has IPv6 traffic that could bypass the tunnel, so ::/0 buys them nothing. Detect a global IPv6 address once while building the config context and drop ::/0 when there is none. Link-local and unique local addresses do not count: they never reach the IPv6 internet. Co-authored-by: liuclare <177657698+liuclare@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
35 lines
1.4 KiB
C#
35 lines
1.4 KiB
C#
namespace ServiceLib.Models.CoreConfigs;
|
|
|
|
public record CoreConfigContext
|
|
{
|
|
public required ProfileItem Node { get; init; }
|
|
public required ECoreType RunCoreType { get; init; }
|
|
public RoutingItem? RoutingItem { get; init; }
|
|
public DNSItem? RawDnsItem { get; init; }
|
|
public SimpleDNSItem SimpleDnsItem { get; init; } = new();
|
|
public Dictionary<string, ProfileItem> AllProxiesMap { get; init; } = new();
|
|
public Config AppConfig { get; init; } = new();
|
|
public FullConfigTemplateItem? FullConfigTemplate { get; init; } = new();
|
|
|
|
public Dictionary<string, string> CustomOutboundContent { get; init; } = new();
|
|
|
|
// Test ServerTestItem Map
|
|
public Dictionary<string, string> ServerTestItemMap { get; init; } = new();
|
|
|
|
// TUN Compatibility
|
|
public bool IsTunEnabled { get; init; } = false;
|
|
public HashSet<string> ProtectDomainList { get; init; } = [];
|
|
// Typically, it is the core of the outbound chain
|
|
public HashSet<ECoreType> ProtectCoreTypeList { get; init; } = [];
|
|
|
|
public bool IsWindows { get; init; }
|
|
public bool IsMacOS { get; init; }
|
|
|
|
// Defaults to true so that a context built without this flag keeps routing IPv6 into the
|
|
// tunnel; only a positive detection of the host having no global IPv6 address turns it off.
|
|
public bool HasGlobalIPv6Address { get; init; } = true;
|
|
|
|
// Generation Context
|
|
public Dictionary<object, string> CustomOutboundMap { get; init; } = new();
|
|
}
|