diff --git a/.gitignore b/.gitignore index b0d663c..43038f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ /.idea/ /Libbox.xcframework/ xcuserdata/ -.DS_Store/ +.DS_Store /build/ /sing-box.xcodeproj/project.pbxproj.back CLAUDE.md diff --git a/ApplicationLibrary/Views/Setting/ProfileOverrideView.swift b/ApplicationLibrary/Views/Setting/ProfileOverrideView.swift index 5f76352..1984f2a 100644 --- a/ApplicationLibrary/Views/Setting/ProfileOverrideView.swift +++ b/ApplicationLibrary/Views/Setting/ProfileOverrideView.swift @@ -18,18 +18,18 @@ public struct ProfileOverrideView: View { } } else { FormView { - FormToggle("Hide VPN Icon", "Append `0.0.0.0/31` to `inet4_route_exclude_address` if not exists.", $excludeDefaultRoute) { newValue in + FormToggle("Hide VPN Icon", "Append `0.0.0.0/31` and `::/127` to `route_exclude_address` if not exists.", $excludeDefaultRoute) { newValue in await SharedPreferences.excludeDefaultRoute.set(newValue) } FormToggle("No Default Route", """ By default, segment routing is used in `auto_route` instead of global routing. - If `*_` exists in the configuration, this item will not take effect on the corresponding network (commonly used to resolve HomeKit compatibility issues). + If `` exists in the configuration, this item will not take effect on the corresponding network (commonly used to resolve HomeKit compatibility issues). """, $autoRouteUseSubRangesByDefault) { newValue in await SharedPreferences.autoRouteUseSubRangesByDefault.set(newValue) } - FormToggle("Exclude APNs Route", "Append `push.apple.com` to `bypass_domain`, and `17.0.0.0/8` to `inet4_route_exclude_address`.", $excludeAPNsRoute) { newValue in + FormToggle("Exclude APNs Route", "Append `push.apple.com` to `bypass_domain`, and `17.0.0.0/8` to `route_exclude_address`.", $excludeAPNsRoute) { newValue in await SharedPreferences.excludeAPNsRoute.set(newValue) } diff --git a/Library/Network/ExtensionPlatformInterface.swift b/Library/Network/ExtensionPlatformInterface.swift index fcc00f2..eeb3986 100644 --- a/Library/Network/ExtensionPlatformInterface.swift +++ b/Library/Network/ExtensionPlatformInterface.swift @@ -134,6 +134,14 @@ public class ExtensionPlatformInterface: NSObject, LibboxPlatformInterfaceProtoc ipv6ExcludeRoutes.append(NEIPv6Route(destinationAddress: ipv6RoutePrefix.address(), networkPrefixLength: NSNumber(value: ipv6RoutePrefix.prefix()))) } + if await SharedPreferences.excludeDefaultRoute.get(), !ipv6Routes.isEmpty { + if !ipv6ExcludeRoutes.contains(where: { it in + it.destinationAddress == "::" && it.destinationNetworkPrefixLength == 127 + }) { + ipv6ExcludeRoutes.append(NEIPv6Route(destinationAddress: "::", networkPrefixLength: 127)) + } + } + ipv6Settings.includedRoutes = ipv6Routes ipv6Settings.excludedRoutes = ipv6ExcludeRoutes settings.ipv6Settings = ipv6Settings diff --git a/Localizable.xcstrings b/Localizable.xcstrings index f538e12..52c2e1c 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -100,22 +100,22 @@ } } }, - "Append `0.0.0.0/31` to `inet4_route_exclude_address` if not exists." : { + "Append `0.0.0.0/31` and `::/127` to `route_exclude_address` if not exists." : { "localizations" : { "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "将会附加 `0.0.0.0/31` 到 `inet4_route_exclude_address`。" + "value" : "将会附加 `0.0.0.0/31` 和 `::/127` 到 `route_exclude_address`。" } } } }, - "Append `push.apple.com` to `bypass_domain`, and `17.0.0.0/8` to `inet4_route_exclude_address`." : { + "Append `push.apple.com` to `bypass_domain`, and `17.0.0.0/8` to `route_exclude_address`." : { "localizations" : { "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "将会附加 `push.apple.com` 到 `bypass_domain`, 附加 `17.0.0.0/8` 到 `inet4_route_exclude_address`。" + "value" : "将会附加 `push.apple.com` 到 `bypass_domain`, 附加 `17.0.0.0/8` 到 `route_exclude_address`。" } } } @@ -176,12 +176,12 @@ } } }, - "By default, segment routing is used in `auto_route` instead of global routing.\nIf `*_` exists in the configuration, this item will not take effect on the corresponding network (commonly used to resolve HomeKit compatibility issues)." : { + "By default, segment routing is used in `auto_route` instead of global routing.\nIf `` exists in the configuration, this item will not take effect on the corresponding network (commonly used to resolve HomeKit compatibility issues)." : { "localizations" : { "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "在默认情况下,`auto_route` 中使用分段路由,而非全局路由。\n若配置中存在 `*_`,则此项不会在对应网络上生效(常用于解决 HomeKit 兼容性问题)。" + "value" : "在默认情况下,`auto_route` 中使用分段路由,而非全局路由。\n若配置中存在 ``,则此项不会在对应网络上生效(常用于解决 HomeKit 兼容性问题)。" } } }