mirror of
https://github.com/wgtunnel/android.git
synced 2026-07-03 14:07:49 +02:00
+5
-2
@@ -27,6 +27,10 @@ import com.zaneschepke.wireguardautotunnel.ui.screens.main.config.state.ConfigUi
|
||||
@Composable
|
||||
fun InterfaceSection(uiState: ConfigUiState, viewModel: ConfigViewModel) {
|
||||
var isDropDownExpanded by remember { mutableStateOf(false) }
|
||||
val isAmneziaCompatibilitySet =
|
||||
remember(uiState.configProxy.`interface`) {
|
||||
uiState.configProxy.`interface`.isAmneziaCompatibilityModeSet()
|
||||
}
|
||||
|
||||
Surface(shape = RoundedCornerShape(12.dp), color = MaterialTheme.colorScheme.surface) {
|
||||
Column(
|
||||
@@ -44,8 +48,7 @@ fun InterfaceSection(uiState: ConfigUiState, viewModel: ConfigViewModel) {
|
||||
onExpandedChange = { isDropDownExpanded = it },
|
||||
showScripts = uiState.showScripts,
|
||||
showAmneziaValues = uiState.showAmneziaValues,
|
||||
isAmneziaCompatibilitySet =
|
||||
uiState.configProxy.`interface`.isAmneziaCompatibilityModeSet(),
|
||||
isAmneziaCompatibilitySet = isAmneziaCompatibilitySet,
|
||||
onToggleScripts = viewModel::toggleScripts,
|
||||
onToggleAmneziaValues = viewModel::toggleAmneziaValues,
|
||||
onToggleAmneziaCompatibility = viewModel::toggleAmneziaCompatibility,
|
||||
|
||||
@@ -75,10 +75,7 @@ data class InterfaceProxy(
|
||||
}
|
||||
|
||||
fun isAmneziaCompatibilityModeSet(): Boolean {
|
||||
return junkPacketCount.toIntOrNull() in 3..<5 &&
|
||||
junkPacketMinSize.toIntOrNull() == 40 &&
|
||||
junkPacketMaxSize.toIntOrNull() == 70 &&
|
||||
with(initPacketJunkSize.toIntOrNull()) { this == 0 || this == null } &&
|
||||
return with(initPacketJunkSize.toIntOrNull()) { this == 0 || this == null } &&
|
||||
with(responsePacketJunkSize.toIntOrNull()) { this == 0 || this == null } &&
|
||||
initPacketMagicHeader.toLongOrNull() == 1L &&
|
||||
responsePacketMagicHeader.toLongOrNull() == 2L &&
|
||||
|
||||
Reference in New Issue
Block a user