diff --git a/app/src/main/java/io/nekohasekai/sagernet/Constants.kt b/app/src/main/java/io/nekohasekai/sagernet/Constants.kt index 832c6b4b..15430622 100644 --- a/app/src/main/java/io/nekohasekai/sagernet/Constants.kt +++ b/app/src/main/java/io/nekohasekai/sagernet/Constants.kt @@ -94,6 +94,7 @@ object Key { const val SERVER_SECURITY_CATEGORY = "serverSecurityCategory" const val SERVER_TLS_CAMOUFLAGE_CATEGORY = "serverTlsCamouflageCategory" + const val SERVER_ECH_CATEORY = "serverECHCategory" const val SERVER_WS_CATEGORY = "serverWsCategory" const val SERVER_SS_CATEGORY = "serverSsCategory" const val SERVER_HEADERS = "serverHeaders" diff --git a/app/src/main/java/io/nekohasekai/sagernet/fmt/v2ray/StandardV2RayBean.java b/app/src/main/java/io/nekohasekai/sagernet/fmt/v2ray/StandardV2RayBean.java index bdf7d601..00f1fdde 100644 --- a/app/src/main/java/io/nekohasekai/sagernet/fmt/v2ray/StandardV2RayBean.java +++ b/app/src/main/java/io/nekohasekai/sagernet/fmt/v2ray/StandardV2RayBean.java @@ -48,6 +48,16 @@ public abstract class StandardV2RayBean extends AbstractBean { public String certificates; + // --------------------------------------- ech + + public Boolean enableECH; + + public Boolean enablePqSignature; + + public Boolean disabledDRS; + + public String echConfig; + // --------------------------------------- // public Integer packetEncoding; // 1:packet 2:xudp @@ -84,6 +94,11 @@ public void initializeDefaultValues() { if (realityPubKey == null) realityPubKey = ""; if (realityShortId == null) realityShortId = ""; + + if (enableECH == null) enableECH = false; + if (JavaUtil.isNullOrBlank(echConfig)) echConfig = ""; + if (enablePqSignature == null) enablePqSignature = false; + if (disabledDRS == null) disabledDRS = false; } @Override diff --git a/app/src/main/java/io/nekohasekai/sagernet/fmt/v2ray/V2RayFmt.kt b/app/src/main/java/io/nekohasekai/sagernet/fmt/v2ray/V2RayFmt.kt index ff5bb41f..3abf518d 100644 --- a/app/src/main/java/io/nekohasekai/sagernet/fmt/v2ray/V2RayFmt.kt +++ b/app/src/main/java/io/nekohasekai/sagernet/fmt/v2ray/V2RayFmt.kt @@ -598,6 +598,12 @@ fun buildSingBoxOutboundTLS(bean: StandardV2RayBean): OutboundTLSOptions? { fingerprint = fp } } + if (bean.enableECH) { + ech.enabled = true + ech.pq_signature_schemes_enabled = bean.enablePqSignature + ech.dynamic_record_sizing_disabled = bean.disabledDRS + ech.config = bean.echConfig.lines() + } } } diff --git a/app/src/main/java/io/nekohasekai/sagernet/ui/profile/StandardV2RaySettingsActivity.kt b/app/src/main/java/io/nekohasekai/sagernet/ui/profile/StandardV2RaySettingsActivity.kt index 9c242e77..40a39eb7 100644 --- a/app/src/main/java/io/nekohasekai/sagernet/ui/profile/StandardV2RaySettingsActivity.kt +++ b/app/src/main/java/io/nekohasekai/sagernet/ui/profile/StandardV2RaySettingsActivity.kt @@ -44,6 +44,11 @@ abstract class StandardV2RaySettingsActivity : ProfileSettingsActivity - updateTle(newValue as String) + updateTls(newValue as String) true } } @@ -166,10 +173,11 @@ abstract class StandardV2RaySettingsActivity : ProfileSettingsActivity根据 IPv6 策略解析服务器地址 自动选择需要代理的应用 自动选择需要代理的应用,这将清除您当前的选择。 + 启用 ECH 技术支持 + 启用 ECH + ECH 设置 + 启用对后量子对等证书签名方案支持 + 禁用TLS记录的自适应调整大小 + 如果启用,将始终使用最大可能的TLS记录大小。当禁用时,TLS记录的大小可能会进行调整以尝试提高延迟。 + ECH 配置 \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index afe1f148..18b36a15 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -519,5 +519,12 @@ Anyone can write advanced plugins, which can control NekoBox. please download an Resolve the server address according to the IPv6 policy Auto select proxy apps Auto select proxy apps, this will clear your current selection. + Enable ECH + Enable Encrypted Client Hello + ECH Settings + Enable post-quantum peer certificate signature supports + Disables adaptive sizing of TLS records + ECH Config + If enable, the largest possible TLS record size is always used. When disable, the size of TLS records may be adjusted in an attempt to improve latency. \ No newline at end of file diff --git a/app/src/main/res/xml/standard_v2ray_preferences.xml b/app/src/main/res/xml/standard_v2ray_preferences.xml index 35caa8d1..0f4d6f69 100644 --- a/app/src/main/res/xml/standard_v2ray_preferences.xml +++ b/app/src/main/res/xml/standard_v2ray_preferences.xml @@ -118,6 +118,11 @@ app:key="allowInsecure" app:summary="@string/allow_insecure_sum" app:title="@string/allow_insecure" /> + + + + + + + \ No newline at end of file