Add xray-core tun mode (#5150)

* Add xray-core tun mode

The service start-up sequence is changed:
vpn service is created first,
a file descriptor to the underlining vpn service can then be passed to xray-core,
Xray core then create the TUN inbound from it

* Remove badvpn-tun2socks
This commit is contained in:
yuhan6665
2026-01-12 01:16:44 -05:00
committed by GitHub
parent bd60224577
commit 73d1dce4db
20 changed files with 210 additions and 60 deletions
@@ -62,7 +62,8 @@ class SettingsViewModel(application: Application) : AndroidViewModel(application
AppConfig.PREF_FRAGMENT_INTERVAL,
AppConfig.PREF_MUX_XUDP_QUIC,
AppConfig.PREF_HEV_TUNNEL_LOGLEVEL,
AppConfig.PREF_HEV_TUNNEL_RW_TIMEOUT
AppConfig.PREF_HEV_TUNNEL_RW_TIMEOUT,
AppConfig.PREF_TUN,
-> {
MmkvManager.encodeSettings(key, sharedPreferences.getString(key, ""))
}
@@ -83,18 +84,19 @@ class SettingsViewModel(application: Application) : AndroidViewModel(application
AppConfig.PREF_DOUBLE_COLUMN_DISPLAY,
AppConfig.SUBSCRIPTION_AUTO_UPDATE,
AppConfig.PREF_FRAGMENT_ENABLED,
AppConfig.PREF_MUX_ENABLED
AppConfig.PREF_MUX_ENABLED,
-> {
MmkvManager.encodeSettings(key, sharedPreferences.getBoolean(key, false))
}
AppConfig.PREF_SNIFFING_ENABLED,
AppConfig.PREF_USE_HEV_TUNNEL -> {
-> {
MmkvManager.encodeSettings(key, sharedPreferences.getBoolean(key, true))
}
AppConfig.PREF_MUX_CONCURRENCY,
AppConfig.PREF_MUX_XUDP_CONCURRENCY -> {
AppConfig.PREF_MUX_XUDP_CONCURRENCY,
-> {
MmkvManager.encodeSettings(key, sharedPreferences.getString(key, "8"))
}
}