Skip to content

Commit 2f21cd6

Browse files
committed
Improve SOCKS5 auth status display with separate username and password labels and Show Active Resolvers count in connection status after VPN connects
1 parent 376e260 commit 2f21cd6

2 files changed

Lines changed: 32 additions & 4 deletions

File tree

android/app/src/main/java/com/masterdns/vpn/ui/home/HomeScreen.kt

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,13 @@ fun HomeScreen(
280280
style = MaterialTheme.typography.bodySmall
281281
)
282282
}
283+
if (scanStatus.activeResolvers > 0) {
284+
Spacer(modifier = Modifier.height(2.dp))
285+
Text(
286+
text = "Active Resolvers: ${scanStatus.activeResolvers}",
287+
style = MaterialTheme.typography.bodySmall.copy(fontWeight = FontWeight.SemiBold)
288+
)
289+
}
283290
Spacer(modifier = Modifier.height(6.dp))
284291
Text(
285292
text = "Download: ${formatSpeed(downBps)} Upload: ${formatSpeed(upBps)}",
@@ -290,12 +297,24 @@ fun HomeScreen(
290297
text = "SOCKS5: $proxyHost:$proxyPort",
291298
style = MaterialTheme.typography.bodySmall.copy(fontWeight = FontWeight.SemiBold)
292299
)
293-
if (socksAuthEnabled && socksUser.isNotBlank() && socksPass.isNotBlank()) {
294-
Spacer(modifier = Modifier.height(2.dp))
300+
if (socksAuthEnabled) {
301+
Spacer(modifier = Modifier.height(6.dp))
295302
Text(
296-
text = "Auth: $socksUser / $socksPass",
297-
style = MaterialTheme.typography.bodySmall
303+
text = "SOCKS5 authentication",
304+
style = MaterialTheme.typography.bodySmall.copy(fontWeight = FontWeight.SemiBold)
298305
)
306+
if (socksUser.isNotBlank()) {
307+
Text(
308+
text = "Username: $socksUser",
309+
style = MaterialTheme.typography.bodySmall
310+
)
311+
}
312+
if (socksPass.isNotBlank()) {
313+
Text(
314+
text = "Password: $socksPass",
315+
style = MaterialTheme.typography.bodySmall
316+
)
317+
}
299318
}
300319
}
301320
}

android/app/src/main/java/com/masterdns/vpn/util/VpnManager.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ object VpnManager {
4949
val lastDecision: String = "",
5050
val validCount: Int = 0,
5151
val rejectedCount: Int = 0,
52+
val activeResolvers: Int = 0,
5253
val syncedUploadMtu: Int = 0,
5354
val syncedDownloadMtu: Int = 0
5455
)
@@ -194,6 +195,14 @@ object VpnManager {
194195
return
195196
}
196197

198+
val activeResolversMatch = Regex("Active Resolvers\\s*[:]\\s*(\\d+)", RegexOption.IGNORE_CASE).find(line)
199+
if (activeResolversMatch != null) {
200+
_scanStatus.value = _scanStatus.value.copy(
201+
activeResolvers = activeResolversMatch.groupValues[1].toIntOrNull() ?: _scanStatus.value.activeResolvers
202+
)
203+
return
204+
}
205+
197206
val syncedMatch = Regex(
198207
"Selected Synced Upload MTU:\\s*(\\d+)\\s*\\|\\s*Selected Synced Download MTU:\\s*(\\d+)",
199208
RegexOption.IGNORE_CASE

0 commit comments

Comments
 (0)