Fix mux enabled

This commit is contained in:
2dust
2023-11-15 19:17:02 +08:00
parent 84fc909339
commit 683362f0ee
2 changed files with 23 additions and 5 deletions

View File

@@ -401,17 +401,35 @@ object V2rayConfigUtil {
private fun updateOutboundWithGlobalSettings(outbound: V2rayConfig.OutboundBean): Boolean {
try {
if (settingsStorage?.decodeBool(AppConfig.PREF_MUX_ENABLED) == true) {
var muxEnabled = settingsStorage?.decodeBool(AppConfig.PREF_MUX_ENABLED, false)
val protocol = outbound.protocol
if (protocol.equals(EConfigType.SHADOWSOCKS.name, true)
|| protocol.equals(EConfigType.SOCKS.name, true)
|| protocol.equals(EConfigType.TROJAN.name, true)
) {
muxEnabled = false
} else if (protocol.equals(EConfigType.VLESS.name, true)
&& outbound.settings?.vnext?.get(0)?.users?.get(0)?.flow?.isNotEmpty() == true
) {
muxEnabled = false
}
if (muxEnabled == true) {
outbound.mux?.enabled = true
outbound.mux?.concurrency = 8
outbound.mux?.xudpConcurrency = settingsStorage?.decodeInt(AppConfig.PREF_MUX_XUDP_CONCURRENCY) ?: 8
outbound.mux?.xudpProxyUDP443 = settingsStorage?.decodeString(AppConfig.PREF_MUX_XUDP_QUIC) ?: "reject"
outbound.mux?.xudpConcurrency =
settingsStorage?.decodeInt(AppConfig.PREF_MUX_XUDP_CONCURRENCY) ?: 8
outbound.mux?.xudpProxyUDP443 =
settingsStorage?.decodeString(AppConfig.PREF_MUX_XUDP_QUIC) ?: "reject"
} else {
outbound.mux?.enabled = false
outbound.mux?.concurrency = -1
}
if (outbound.streamSettings?.network == DEFAULT_NETWORK
&& outbound.streamSettings?.tcpSettings?.header?.type == HTTP) {
&& outbound.streamSettings?.tcpSettings?.header?.type == HTTP
) {
val path = outbound.streamSettings?.tcpSettings?.header?.request?.path
val host = outbound.streamSettings?.tcpSettings?.header?.request?.headers?.Host

View File

@@ -97,7 +97,7 @@
<string name="summary_pref_per_app_proxy">常规:勾选的App被代理,未勾选的直连;\n绕行模式:勾选的App直连,未勾选的被代理.\n不明白者在菜单中选择自动选中需代理应用</string>
<string name="title_pref_mux_enabled">启用 Mux 多路复用</string>
<string name="summary_pref_mux_enabled">减低延时 但可能会断流\nTCP 默认复用 8 个子链接UDP 及 QUIC 流量处理方式下方可选</string>
<string name="summary_pref_mux_enabled">减低延时但可能会断流,建议不要启用。\nTCP 默认复用 8 个子链接UDP 及 QUIC 流量处理方式下方可选</string>
<string name="title_pref_mux_xudp_concurency">XUDP 复用子链接数(可填 -1 至 1024</string>
<string name="title_pref_mux_xudp_quic">QUIC 流量处理方式</string>
<string-array name="mux_xudp_quic_entries">