Skip to content

Commit

Permalink
Merge pull request #2889 from vfarid/more_fragment_options
Browse files Browse the repository at this point in the history
More fragment options + Fix for reality configs
  • Loading branch information
2dust committed Mar 3, 2024
2 parents 945c584 + 58dbb71 commit b02d81a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
15 changes: 13 additions & 2 deletions V2rayNG/app/src/main/kotlin/com/v2ray/ang/util/V2rayConfigUtil.kt
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions V2rayNG/app/src/main/res/values/arrays.xml
Expand Up @@ -62,6 +62,9 @@

<string-array name="fragment_packets" translatable="false">
<item>tlshello</item>
<item>1-2</item>
<item>1-3</item>
<item>1-5</item>
</string-array>

<string-array name="streamsecurity_utls" translatable="false">
Expand Down

0 comments on commit b02d81a

Please sign in to comment.