Fix MTU conflict with mieru plugin (#529)

* Fix MTU conflict with mieru plugin

* Add protect path to mieru plugin
This commit is contained in:
enfein 2024-01-28 15:43:19 +01:00 committed by GitHub
parent 0edc97aa2e
commit f66437c18d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 8 additions and 4 deletions

View File

@ -90,6 +90,7 @@ object Key {
const val SERVER_ENCRYPTION = "serverEncryption"
const val SERVER_ALPN = "serverALPN"
const val SERVER_CERTIFICATES = "serverCertificates"
const val SERVER_MTU = "serverMTU"
const val SERVER_CONFIG = "serverConfig"
const val SERVER_CUSTOM = "serverCustom"

View File

@ -147,6 +147,7 @@ abstract class BoxInstance(
val envMap = mutableMapOf<String, String>()
envMap["MIERU_CONFIG_JSON_FILE"] = configFile.absolutePath
envMap["MIERU_PROTECT_PATH"] = "protect_path"
val commands = mutableListOf(
initPlugin("mieru-plugin").path, "run",

View File

@ -189,6 +189,7 @@ object DataStore : OnPreferenceDataStoreChangeListener {
var serverEncryption by profileCacheStore.string(Key.SERVER_ENCRYPTION)
var serverALPN by profileCacheStore.string(Key.SERVER_ALPN)
var serverCertificates by profileCacheStore.string(Key.SERVER_CERTIFICATES)
var serverMTU by profileCacheStore.stringToInt(Key.SERVER_MTU)
var serverHeaders by profileCacheStore.string(Key.SERVER_HEADERS)
var serverAllowInsecure by profileCacheStore.boolean(Key.SERVER_ALLOW_INSECURE)

View File

@ -47,6 +47,7 @@ fun MieruBean.buildMieruConfig(port: Int): String {
put("password", password)
})
put("servers", serverInfo)
put("mtu", mtu)
})
})
}.toStringPretty()

View File

@ -41,7 +41,7 @@ class MieruSettingsActivity : ProfileSettingsActivity<MieruBean>() {
DataStore.serverProtocol = protocol
DataStore.serverUsername = username
DataStore.serverPassword = password
DataStore.mtu = mtu
DataStore.serverMTU = mtu
}
override fun MieruBean.serialize() {
@ -51,7 +51,7 @@ class MieruSettingsActivity : ProfileSettingsActivity<MieruBean>() {
protocol = DataStore.serverProtocol
username = DataStore.serverUsername
password = DataStore.serverPassword
mtu = DataStore.mtu
mtu = DataStore.serverMTU
}
override fun PreferenceFragmentCompat.createPreferences(
@ -66,7 +66,7 @@ class MieruSettingsActivity : ProfileSettingsActivity<MieruBean>() {
summaryProvider = PasswordSummaryProvider
}
val protocol = findPreference<SimpleMenuPreference>(Key.SERVER_PROTOCOL)!!
val mtu = findPreference<EditTextPreference>(Key.MTU)!!
val mtu = findPreference<EditTextPreference>(Key.SERVER_MTU)!!
mtu.isVisible = protocol.value.equals("UDP")
protocol.setOnPreferenceChangeListener { _, newValue ->
mtu.isVisible = newValue.equals("UDP")

View File

@ -38,7 +38,7 @@
app:title="@string/password" />
<EditTextPreference
app:icon="@drawable/baseline_public_24"
app:key="mtu"
app:key="serverMTU"
app:title="@string/mtu"
app:useSimpleSummaryProvider="true" />
</PreferenceCategory>