From ebd0257f6eee231f9ef716fad7d410d912467dea Mon Sep 17 00:00:00 2001 From: Vahid Farid Date: Sat, 2 Mar 2024 16:53:34 +0330 Subject: [PATCH 1/2] Added new fragment packets for reality --- V2rayNG/app/src/main/res/values/arrays.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/V2rayNG/app/src/main/res/values/arrays.xml b/V2rayNG/app/src/main/res/values/arrays.xml index c64f0fb3..a10330e4 100644 --- a/V2rayNG/app/src/main/res/values/arrays.xml +++ b/V2rayNG/app/src/main/res/values/arrays.xml @@ -62,6 +62,9 @@ tlshello + 1-2 + 1-3 + 1-5 From 58dbb71b5377078c115bde335ee733d25b4cb40d Mon Sep 17 00:00:00 2001 From: Vahid Farid Date: Sat, 2 Mar 2024 16:54:17 +0330 Subject: [PATCH 2/2] Fix fragment for reality configs --- .../kotlin/com/v2ray/ang/util/V2rayConfigUtil.kt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/V2rayConfigUtil.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/V2rayConfigUtil.kt index 2f61c2ab..a2222fd8 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/V2rayConfigUtil.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/V2rayConfigUtil.kt @@ -581,10 +581,21 @@ object V2rayConfigUtil { tag = TAG_FRAGMENT, mux = null ) + + var packets = settingsStorage?.decodeString(AppConfig.PREF_FRAGMENT_PACKETS) ?: "tlshello" + if (v2rayConfig.outbounds[0].streamSettings?.security == V2rayConfig.REALITY + && packets == "tlshello" + ) { + packets = "1-3" + } else if (v2rayConfig.outbounds[0].streamSettings?.security == V2rayConfig.TLS + && packets != "tlshello" + ) { + packets = "tlshello" + } + fragmentOutbound.settings = V2rayConfig.OutboundBean.OutSettingsBean( fragment = V2rayConfig.OutboundBean.OutSettingsBean.FragmentBean( - packets = settingsStorage?.decodeString(AppConfig.PREF_FRAGMENT_PACKETS) - ?: "tlshello", + packets = packets, length = settingsStorage?.decodeString(AppConfig.PREF_FRAGMENT_LENGTH) ?: "50-100", interval = settingsStorage?.decodeString(AppConfig.PREF_FRAGMENT_INTERVAL)