Skip to content

Commit 6da54c8

Browse files
Keep resolver scan branch isolated
Remove traffic-clarity and field-tested config changes from the resolver scan branch so that work remains owned by the setup readiness branch. Keep the scan budget tests positioned with the parallel settings coverage so the branch merges cleanly after setup readiness.
1 parent dc41da3 commit 6da54c8

7 files changed

Lines changed: 26 additions & 317 deletions

File tree

app/src/main/java/shop/whitedns/client/model/WhiteDnsAutoTune.kt

Lines changed: 1 addition & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -3,57 +3,16 @@ package shop.whitedns.client.model
33
data class WhiteDnsAutoTunePreset(
44
val id: String,
55
val label: String,
6-
val listenIp: String? = null,
7-
val listenPort: String? = null,
8-
val httpProxyEnabled: Boolean? = null,
9-
val httpProxyPort: String? = null,
10-
val socks5Authentication: Boolean? = null,
11-
val socksUsername: String? = null,
12-
val socksPassword: String? = null,
13-
val localDnsEnabled: Boolean? = null,
14-
val localDnsPort: String? = null,
15-
val balancingStrategy: Int? = null,
166
val minUploadMtu: String,
177
val maxUploadMtu: String,
188
val minDownloadMtu: String,
199
val maxDownloadMtu: String,
2010
val resolverTimeoutSeconds: String,
21-
val resolverRetries: String? = null,
22-
val resolverParallelism: String? = null,
23-
val logRetries: String? = null,
24-
val logTimeoutSeconds: String? = null,
25-
val logParallelism: String? = null,
2611
val dnsResponseFragmentStoreCapacity: String,
2712
val uploadDuplication: String,
2813
val downloadDuplication: String,
2914
val uploadCompression: Int,
3015
val downloadCompression: Int,
31-
val baseEncodeData: Boolean? = null,
32-
val rxTxWorkers: String? = null,
33-
val tunnelProcessWorkers: String? = null,
34-
val tunnelPacketTimeoutSeconds: String? = null,
35-
val dispatcherIdlePollIntervalSeconds: String? = null,
36-
val txChannelSize: String? = null,
37-
val rxChannelSize: String? = null,
38-
val resolverUdpConnectionPoolSize: String? = null,
39-
val streamQueueInitialCapacity: String? = null,
40-
val orphanQueueInitialCapacity: String? = null,
41-
val maxActiveStreams: String? = null,
42-
val localHandshakeTimeoutSeconds: String? = null,
43-
val socksUdpAssociateReadTimeoutSeconds: String? = null,
44-
val clientTerminalStreamRetentionSeconds: String? = null,
45-
val clientCancelledSetupRetentionSeconds: String? = null,
46-
val sessionInitRetryBaseSeconds: String? = null,
47-
val sessionInitRetryStepSeconds: String? = null,
48-
val sessionInitRetryLinearAfter: String? = null,
49-
val sessionInitRetryMaxSeconds: String? = null,
50-
val sessionInitBusyRetryIntervalSeconds: String? = null,
51-
val startupMode: String? = null,
52-
val pingWatchdogSeconds: String? = null,
53-
val trafficWarmupEnabled: Boolean? = null,
54-
val trafficWarmupProbeCount: String? = null,
55-
val trafficKeepaliveIntervalSeconds: String? = null,
56-
val logLevel: String? = null,
5716
)
5817

5918
object WhiteDnsAutoTunePresets {
@@ -156,61 +115,6 @@ object WhiteDnsAutoTunePresets {
156115
uploadCompression = 2,
157116
downloadCompression = 2,
158117
),
159-
WhiteDnsAutoTunePreset(
160-
id = "field-milad-telegram",
161-
label = "Milad Telegram Proxy",
162-
listenIp = "127.0.0.1",
163-
listenPort = "10886",
164-
httpProxyEnabled = true,
165-
httpProxyPort = "10887",
166-
socks5Authentication = false,
167-
socksUsername = "master_dns_vpn",
168-
socksPassword = "master_dns_vpn",
169-
localDnsEnabled = false,
170-
localDnsPort = "53",
171-
balancingStrategy = 3,
172-
minUploadMtu = "5",
173-
maxUploadMtu = "30",
174-
minDownloadMtu = "300",
175-
maxDownloadMtu = "300",
176-
resolverTimeoutSeconds = "3.0",
177-
resolverRetries = "3",
178-
resolverParallelism = "100",
179-
logRetries = "5",
180-
logTimeoutSeconds = "2.0",
181-
logParallelism = "32",
182-
dnsResponseFragmentStoreCapacity = "64",
183-
uploadDuplication = "3",
184-
downloadDuplication = "4",
185-
uploadCompression = 2,
186-
downloadCompression = 2,
187-
baseEncodeData = false,
188-
rxTxWorkers = "4",
189-
tunnelProcessWorkers = "4",
190-
tunnelPacketTimeoutSeconds = "10.0",
191-
dispatcherIdlePollIntervalSeconds = "0.02",
192-
txChannelSize = "2048",
193-
rxChannelSize = "2048",
194-
resolverUdpConnectionPoolSize = "64",
195-
streamQueueInitialCapacity = "128",
196-
orphanQueueInitialCapacity = "32",
197-
maxActiveStreams = "2048",
198-
localHandshakeTimeoutSeconds = "5.0",
199-
socksUdpAssociateReadTimeoutSeconds = "30.0",
200-
clientTerminalStreamRetentionSeconds = "45.0",
201-
clientCancelledSetupRetentionSeconds = "120.0",
202-
sessionInitRetryBaseSeconds = "1.0",
203-
sessionInitRetryStepSeconds = "1.0",
204-
sessionInitRetryLinearAfter = "5",
205-
sessionInitRetryMaxSeconds = "60.0",
206-
sessionInitBusyRetryIntervalSeconds = "60.0",
207-
startupMode = "resolvers",
208-
pingWatchdogSeconds = "30",
209-
trafficWarmupEnabled = true,
210-
trafficWarmupProbeCount = "4",
211-
trafficKeepaliveIntervalSeconds = "5",
212-
logLevel = "WARN",
213-
),
214118
)
215119
}
216120

@@ -278,62 +182,17 @@ object WhiteDnsParallelTest {
278182

279183
fun WhiteDnsSettings.applyAutoTunePreset(preset: WhiteDnsAutoTunePreset): WhiteDnsSettings {
280184
return copy(
281-
listenIp = preset.listenIp ?: listenIp,
282-
listenPort = preset.listenPort ?: listenPort,
283-
httpProxyEnabled = preset.httpProxyEnabled ?: httpProxyEnabled,
284-
httpProxyPort = preset.httpProxyPort ?: httpProxyPort,
285-
socks5Authentication = preset.socks5Authentication ?: socks5Authentication,
286-
socksUsername = preset.socksUsername ?: socksUsername,
287-
socksPassword = preset.socksPassword ?: socksPassword,
288-
localDnsEnabled = preset.localDnsEnabled ?: localDnsEnabled,
289-
localDnsPort = preset.localDnsPort ?: localDnsPort,
290-
balancingStrategy = preset.balancingStrategy ?: balancingStrategy,
291185
minUploadMtu = preset.minUploadMtu,
292186
maxUploadMtu = preset.maxUploadMtu,
293187
minDownloadMtu = preset.minDownloadMtu,
294188
maxDownloadMtu = preset.maxDownloadMtu,
295189
mtuTestTimeoutResolvers = preset.resolverTimeoutSeconds,
296-
mtuTestRetriesResolvers = preset.resolverRetries ?: mtuTestRetriesResolvers,
297-
mtuTestParallelismResolvers = preset.resolverParallelism ?: mtuTestParallelismResolvers,
298-
mtuTestRetriesLogs = preset.logRetries ?: mtuTestRetriesLogs,
299-
mtuTestTimeoutLogs = preset.logTimeoutSeconds ?: preset.resolverTimeoutSeconds,
300-
mtuTestParallelismLogs = preset.logParallelism ?: mtuTestParallelismLogs,
190+
mtuTestTimeoutLogs = preset.resolverTimeoutSeconds,
301191
dnsResponseFragmentStoreCapacity = preset.dnsResponseFragmentStoreCapacity,
302192
uploadDuplication = preset.uploadDuplication,
303193
downloadDuplication = preset.downloadDuplication,
304194
uploadCompression = preset.uploadCompression,
305195
downloadCompression = preset.downloadCompression,
306-
baseEncodeData = preset.baseEncodeData ?: baseEncodeData,
307-
rxTxWorkers = preset.rxTxWorkers ?: rxTxWorkers,
308-
tunnelProcessWorkers = preset.tunnelProcessWorkers ?: tunnelProcessWorkers,
309-
tunnelPacketTimeoutSeconds = preset.tunnelPacketTimeoutSeconds ?: tunnelPacketTimeoutSeconds,
310-
dispatcherIdlePollIntervalSeconds = preset.dispatcherIdlePollIntervalSeconds ?: dispatcherIdlePollIntervalSeconds,
311-
txChannelSize = preset.txChannelSize ?: txChannelSize,
312-
rxChannelSize = preset.rxChannelSize ?: rxChannelSize,
313-
resolverUdpConnectionPoolSize = preset.resolverUdpConnectionPoolSize ?: resolverUdpConnectionPoolSize,
314-
streamQueueInitialCapacity = preset.streamQueueInitialCapacity ?: streamQueueInitialCapacity,
315-
orphanQueueInitialCapacity = preset.orphanQueueInitialCapacity ?: orphanQueueInitialCapacity,
316-
maxActiveStreams = preset.maxActiveStreams ?: maxActiveStreams,
317-
localHandshakeTimeoutSeconds = preset.localHandshakeTimeoutSeconds ?: localHandshakeTimeoutSeconds,
318-
socksUdpAssociateReadTimeoutSeconds = preset.socksUdpAssociateReadTimeoutSeconds
319-
?: socksUdpAssociateReadTimeoutSeconds,
320-
clientTerminalStreamRetentionSeconds = preset.clientTerminalStreamRetentionSeconds
321-
?: clientTerminalStreamRetentionSeconds,
322-
clientCancelledSetupRetentionSeconds = preset.clientCancelledSetupRetentionSeconds
323-
?: clientCancelledSetupRetentionSeconds,
324-
sessionInitRetryBaseSeconds = preset.sessionInitRetryBaseSeconds ?: sessionInitRetryBaseSeconds,
325-
sessionInitRetryStepSeconds = preset.sessionInitRetryStepSeconds ?: sessionInitRetryStepSeconds,
326-
sessionInitRetryLinearAfter = preset.sessionInitRetryLinearAfter ?: sessionInitRetryLinearAfter,
327-
sessionInitRetryMaxSeconds = preset.sessionInitRetryMaxSeconds ?: sessionInitRetryMaxSeconds,
328-
sessionInitBusyRetryIntervalSeconds = preset.sessionInitBusyRetryIntervalSeconds
329-
?: sessionInitBusyRetryIntervalSeconds,
330-
startupMode = preset.startupMode ?: startupMode,
331-
pingWatchdogSeconds = preset.pingWatchdogSeconds ?: pingWatchdogSeconds,
332-
trafficWarmupEnabled = preset.trafficWarmupEnabled ?: trafficWarmupEnabled,
333-
trafficWarmupProbeCount = preset.trafficWarmupProbeCount ?: trafficWarmupProbeCount,
334-
trafficKeepaliveIntervalSeconds = preset.trafficKeepaliveIntervalSeconds
335-
?: trafficKeepaliveIntervalSeconds,
336-
logLevel = preset.logLevel ?: logLevel,
337196
).syncSelectedConnectionProfileFields()
338197
}
339198

app/src/main/java/shop/whitedns/client/model/WhiteDnsModels.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -366,12 +366,6 @@ data class ConnectionStats(
366366
val uploadSpeedBytesPerSecond: Long = 0,
367367
val peakSpeedBytesPerSecond: Long = 0,
368368
val connectedApps: Int = 0,
369-
val estimatedPayloadDownloadBytes: Long = 0,
370-
val estimatedPayloadUploadBytes: Long = 0,
371-
val estimatedPayloadTotalBytes: Long = 0,
372-
val estimatedPayloadDownloadSpeedBytesPerSecond: Long = 0,
373-
val estimatedPayloadUploadSpeedBytesPerSecond: Long = 0,
374-
val hasEstimatedPayloadTraffic: Boolean = false,
375369
)
376370

377371
data class ResolverRuntimeState(

app/src/main/java/shop/whitedns/client/runtime/StormDnsTrafficStats.kt

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,6 @@ data class StormDnsTrafficStats(
1010
val uploadSpeedBytesPerSecond: Long,
1111
)
1212

13-
fun StormDnsTrafficStats.estimateDeduplicatedTraffic(
14-
uploadDuplication: Int,
15-
downloadDuplication: Int,
16-
): StormDnsTrafficStats {
17-
val safeUploadDuplication = uploadDuplication.coerceAtLeast(1).toLong()
18-
val safeDownloadDuplication = downloadDuplication.coerceAtLeast(1).toLong()
19-
return copy(
20-
downloadBytes = downloadBytes.divideRoundedUp(safeDownloadDuplication),
21-
uploadBytes = uploadBytes.divideRoundedUp(safeUploadDuplication),
22-
downloadSpeedBytesPerSecond = downloadSpeedBytesPerSecond.divideRoundedUp(safeDownloadDuplication),
23-
uploadSpeedBytesPerSecond = uploadSpeedBytesPerSecond.divideRoundedUp(safeUploadDuplication),
24-
)
25-
}
26-
2713
class StormDnsTrafficAccounting {
2814
private var lastRawStats: StormDnsTrafficStats? = null
2915
private var accumulatedDownloadBytes: Long = 0L
@@ -127,15 +113,6 @@ private fun parseDataAmount(
127113
return (amount * multiplier).roundToLong().coerceAtLeast(0)
128114
}
129115

130-
private fun Long.divideRoundedUp(divisor: Long): Long {
131-
val safeValue = coerceAtLeast(0)
132-
return if (safeValue == 0L) {
133-
0L
134-
} else {
135-
1L + ((safeValue - 1L) / divisor.coerceAtLeast(1L))
136-
}
137-
}
138-
139116
private val AnsiEscapeRegex = Regex("\\u001B\\[[;\\d]*m")
140117
private val StormDnsTrafficStatsRegex = Regex(
141118
"""([0-9]+(?:\.[0-9]+)?)\s*([KMGT]?B)/s\s*\(Total:\s*([0-9]+(?:\.[0-9]+)?)\s*([KMGT]?B)\)\s*\|\s*[^0-9]*([0-9]+(?:\.[0-9]+)?)\s*([KMGT]?B)/s\s*\(Total:\s*([0-9]+(?:\.[0-9]+)?)\s*([KMGT]?B)\)""",

app/src/main/java/shop/whitedns/client/ui/WhiteDnsScreen.kt

Lines changed: 24 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ private fun ParallelTestSelectionPanel(
10401040
)
10411041
ParallelTestConfigRow(
10421042
label = "WhiteDNS configs",
1043-
detail = "Adds ${whiteDnsConfigIds.size} suggested configs",
1043+
detail = "Adds 7 suggested configs",
10441044
checked = allWhiteDnsSelected,
10451045
enabled = canAddWhiteDnsConfigs,
10461046
onToggle = {
@@ -6789,77 +6789,36 @@ private fun ResolverRuntimeDialog(
67896789
private fun LiveSpeedStrip(
67906790
stats: ConnectionStats,
67916791
) {
6792-
Column(
6792+
Row(
67936793
modifier = Modifier
67946794
.fillMaxWidth()
67956795
.clip(RoundedCornerShape(18.dp))
67966796
.background(WhiteDnsPalette.Surface)
67976797
.border(2.dp, WhiteDnsPalette.Border, RoundedCornerShape(18.dp))
67986798
.padding(8.dp),
6799-
verticalArrangement = Arrangement.spacedBy(8.dp),
6799+
horizontalArrangement = Arrangement.spacedBy(8.dp),
68006800
) {
6801-
Row(
6802-
modifier = Modifier.fillMaxWidth(),
6803-
horizontalArrangement = Arrangement.spacedBy(8.dp),
6804-
) {
6805-
SpeedIndicator(
6806-
icon = Icons.Filled.Download,
6807-
iconContentDescription = stringResource(R.string.cd_icon_download),
6808-
label = "Down",
6809-
value = formatDataSpeed(stats.downloadSpeedBytesPerSecond),
6810-
modifier = Modifier.weight(1f),
6811-
)
6812-
SpeedIndicator(
6813-
icon = Icons.Filled.Upload,
6814-
iconContentDescription = stringResource(R.string.cd_icon_upload),
6815-
label = "Up",
6816-
value = formatDataSpeed(stats.uploadSpeedBytesPerSecond),
6817-
modifier = Modifier.weight(1f),
6818-
)
6819-
SpeedIndicator(
6820-
icon = Icons.Filled.DataUsage,
6821-
iconContentDescription = stringResource(R.string.cd_icon_data_usage),
6822-
label = if (stats.hasEstimatedPayloadTraffic) "Tunnel Total" else "Total Usage",
6823-
value = formatDataSize(stats.totalDataUsageBytes),
6824-
modifier = Modifier.weight(1f),
6825-
)
6826-
}
6827-
if (stats.hasEstimatedPayloadTraffic) {
6828-
Row(
6829-
modifier = Modifier.fillMaxWidth(),
6830-
horizontalArrangement = Arrangement.spacedBy(8.dp),
6831-
) {
6832-
SpeedIndicator(
6833-
icon = Icons.Filled.Download,
6834-
iconContentDescription = stringResource(R.string.cd_icon_download),
6835-
label = "Payload Down",
6836-
value = formatDataSpeed(stats.estimatedPayloadDownloadSpeedBytesPerSecond),
6837-
modifier = Modifier.weight(1f),
6838-
)
6839-
SpeedIndicator(
6840-
icon = Icons.Filled.Upload,
6841-
iconContentDescription = stringResource(R.string.cd_icon_upload),
6842-
label = "Payload Up",
6843-
value = formatDataSpeed(stats.estimatedPayloadUploadSpeedBytesPerSecond),
6844-
modifier = Modifier.weight(1f),
6845-
)
6846-
SpeedIndicator(
6847-
icon = Icons.Filled.DataUsage,
6848-
iconContentDescription = stringResource(R.string.cd_icon_data_usage),
6849-
label = "Payload Est.",
6850-
value = formatDataSize(stats.estimatedPayloadTotalBytes),
6851-
modifier = Modifier.weight(1f),
6852-
)
6853-
}
6854-
Text(
6855-
text = "Tunnel usage includes duplicate DNS packets, warmup, retries, and protocol overhead. Payload estimate divides tunnel counters by the configured duplication counts.",
6856-
style = MaterialTheme.typography.bodySmall.copy(
6857-
fontSize = 10.sp,
6858-
color = WhiteDnsPalette.Muted,
6859-
lineHeight = 14.sp,
6860-
),
6861-
)
6862-
}
6801+
SpeedIndicator(
6802+
icon = Icons.Filled.Download,
6803+
iconContentDescription = stringResource(R.string.cd_icon_download),
6804+
label = "Down",
6805+
value = formatDataSpeed(stats.downloadSpeedBytesPerSecond),
6806+
modifier = Modifier.weight(1f),
6807+
)
6808+
SpeedIndicator(
6809+
icon = Icons.Filled.Upload,
6810+
iconContentDescription = stringResource(R.string.cd_icon_upload),
6811+
label = "Up",
6812+
value = formatDataSpeed(stats.uploadSpeedBytesPerSecond),
6813+
modifier = Modifier.weight(1f),
6814+
)
6815+
SpeedIndicator(
6816+
icon = Icons.Filled.DataUsage,
6817+
iconContentDescription = stringResource(R.string.cd_icon_data_usage),
6818+
label = "Total Usage",
6819+
value = formatDataSize(stats.totalDataUsageBytes),
6820+
modifier = Modifier.weight(1f),
6821+
)
68636822
}
68646823
}
68656824

@@ -7683,18 +7642,6 @@ private fun buildDiagnosticsText(
76837642
appendLine("Traffic total: ${formatDataSize(uiState.connectionStats.totalDataUsageBytes)}")
76847643
appendLine("Traffic down: ${formatDataSpeed(uiState.connectionStats.downloadSpeedBytesPerSecond)}")
76857644
appendLine("Traffic up: ${formatDataSpeed(uiState.connectionStats.uploadSpeedBytesPerSecond)}")
7686-
if (uiState.connectionStats.hasEstimatedPayloadTraffic) {
7687-
appendLine("Estimated payload total: ${formatDataSize(uiState.connectionStats.estimatedPayloadTotalBytes)}")
7688-
appendLine(
7689-
"Estimated payload down: " +
7690-
formatDataSpeed(uiState.connectionStats.estimatedPayloadDownloadSpeedBytesPerSecond),
7691-
)
7692-
appendLine(
7693-
"Estimated payload up: " +
7694-
formatDataSpeed(uiState.connectionStats.estimatedPayloadUploadSpeedBytesPerSecond),
7695-
)
7696-
appendLine("Traffic note: tunnel counters include duplication and DNS/protocol overhead")
7697-
}
76987645
appendLine("Connected apps: ${uiState.connectionStats.connectedApps}")
76997646
appendLine("Active resolvers: ${uiState.resolverRuntimeState.activeResolvers.size}")
77007647
appendLine("Valid resolvers: ${uiState.resolverRuntimeState.validResolvers.size}")

0 commit comments

Comments
 (0)