mirror of
https://github.com/MatsuriDayo/NekoBoxForAndroid.git
synced 2025-12-19 22:50:05 +08:00
update mux
This commit is contained in:
parent
55a2af6779
commit
29a5914e8b
@ -58,6 +58,7 @@ object Key {
|
|||||||
const val ALWAYS_SHOW_ADDRESS = "alwaysShowAddress"
|
const val ALWAYS_SHOW_ADDRESS = "alwaysShowAddress"
|
||||||
|
|
||||||
// Protocol Settings
|
// Protocol Settings
|
||||||
|
const val MUX_TYPE = "muxType"
|
||||||
const val MUX_PROTOCOLS = "mux"
|
const val MUX_PROTOCOLS = "mux"
|
||||||
const val MUX_CONCURRENCY = "muxConcurrency"
|
const val MUX_CONCURRENCY = "muxConcurrency"
|
||||||
|
|
||||||
|
|||||||
@ -167,6 +167,7 @@ object DataStore : OnPreferenceDataStoreChangeListener {
|
|||||||
|
|
||||||
// protocol
|
// protocol
|
||||||
|
|
||||||
|
var muxType by configurationStore.stringToInt(Key.MUX_TYPE)
|
||||||
var muxProtocols by configurationStore.stringSet(Key.MUX_PROTOCOLS)
|
var muxProtocols by configurationStore.stringSet(Key.MUX_PROTOCOLS)
|
||||||
var muxConcurrency by configurationStore.stringToInt(Key.MUX_CONCURRENCY) { 8 }
|
var muxConcurrency by configurationStore.stringToInt(Key.MUX_CONCURRENCY) { 8 }
|
||||||
|
|
||||||
|
|||||||
@ -424,6 +424,11 @@ fun buildConfig(
|
|||||||
currentOutbound["multiplex"] = MultiplexOptions().apply {
|
currentOutbound["multiplex"] = MultiplexOptions().apply {
|
||||||
enabled = true
|
enabled = true
|
||||||
max_streams = DataStore.muxConcurrency
|
max_streams = DataStore.muxConcurrency
|
||||||
|
protocol = when (DataStore.muxType) {
|
||||||
|
1 -> "smux"
|
||||||
|
2 -> "yamux"
|
||||||
|
else -> "h2mux"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,8 +29,7 @@ object Protocols {
|
|||||||
|
|
||||||
fun getCanMuxList(): List<String> {
|
fun getCanMuxList(): List<String> {
|
||||||
// built-in and support mux
|
// built-in and support mux
|
||||||
// TODO support vless mux in sing-box 1.3.x
|
val list = mutableListOf("vmess", "trojan", "trojan-go", "shadowsocks", "vless")
|
||||||
val list = mutableListOf("vmess", "trojan", "trojan-go", "shadowsocks")
|
|
||||||
|
|
||||||
NekoPluginManager.getProtocols().forEach {
|
NekoPluginManager.getProtocols().forEach {
|
||||||
if (it.protocolConfig.optBoolean("canMux")) {
|
if (it.protocolConfig.optBoolean("canMux")) {
|
||||||
|
|||||||
@ -474,4 +474,5 @@
|
|||||||
<string name="mtu_help">长按设置项以设置自定义 MTU。</string>
|
<string name="mtu_help">长按设置项以设置自定义 MTU。</string>
|
||||||
<string name="log_level_help">长按设置项以设置缓冲区大小。</string>
|
<string name="log_level_help">长按设置项以设置缓冲区大小。</string>
|
||||||
<string name="test_concurrency">测试并发</string>
|
<string name="test_concurrency">测试并发</string>
|
||||||
|
<string name="mux_type">Mux 协议</string>
|
||||||
</resources>
|
</resources>
|
||||||
@ -433,6 +433,12 @@
|
|||||||
|
|
||||||
<string-array name="mux_select_init" />
|
<string-array name="mux_select_init" />
|
||||||
|
|
||||||
|
<string-array name="mux_type">
|
||||||
|
<item>h2mux</item>
|
||||||
|
<item>smux</item>
|
||||||
|
<item>yamux</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
<string-array name="dns_network_select">
|
<string-array name="dns_network_select">
|
||||||
<item>NoRemoteIPv4</item>
|
<item>NoRemoteIPv4</item>
|
||||||
<item>NoRemoteIPv6</item>
|
<item>NoRemoteIPv6</item>
|
||||||
|
|||||||
@ -515,5 +515,6 @@ Anyone can write advanced plugins, which can control NekoBox. please download an
|
|||||||
<string name="log_level_help">Long press the preference to set the buffer size.</string>
|
<string name="log_level_help">Long press the preference to set the buffer size.</string>
|
||||||
<string name="tls_camouflage_settings">TLS Camouflage Settings</string>
|
<string name="tls_camouflage_settings">TLS Camouflage Settings</string>
|
||||||
<string name="test_concurrency">Test concurrency</string>
|
<string name="test_concurrency">Test concurrency</string>
|
||||||
|
<string name="mux_type">Mux protocol</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
@ -140,6 +140,13 @@
|
|||||||
app:key="mux"
|
app:key="mux"
|
||||||
app:summary="@string/mux_sum"
|
app:summary="@string/mux_sum"
|
||||||
app:title="@string/enable_mux" />
|
app:title="@string/enable_mux" />
|
||||||
|
<moe.matsuri.nb4a.ui.SimpleMenuPreference
|
||||||
|
app:defaultValue="0"
|
||||||
|
app:entries="@array/mux_type"
|
||||||
|
app:entryValues="@array/int_array_3"
|
||||||
|
app:key="muxType"
|
||||||
|
app:title="@string/mux_type"
|
||||||
|
app:useSimpleSummaryProvider="true" />
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
app:defaultValue="8"
|
app:defaultValue="8"
|
||||||
app:icon="@drawable/ic_baseline_low_priority_24"
|
app:icon="@drawable/ic_baseline_low_priority_24"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user