mirror of
https://github.com/2dust/v2rayNG.git
synced 2026-11-03 19:54:30 +00:00
fix: crash on WireGuard profiles with empty remote DNS (#6379)
When a WireGuard profile has no remote DNS, CoreOutboundBuilder fell
back to listOf(WIREGUARD_LOCAL_REMOTE_DNS). The constant is a single
comma-separated string, so the core received one list element holding
all four addresses and panicked on start:
panic: ParseAddr("1.1.1.1,1.0.0.1,2606:4700:4700::1111,..."):
unexpected character
closes: #6373
This commit is contained in:
1 file changed
+6
-3
@@ -252,18 +252,21 @@ object CoreOutboundBuilder {
|
||||
ipv4Addresses.ifEmpty { listOf(AppConfig.WIREGUARD_LOCAL_ADDRESS_V4) }
|
||||
}
|
||||
|
||||
val defaultDns = AppConfig.WIREGUARD_LOCAL_REMOTE_DNS.split(",").map { it.trim() }
|
||||
|
||||
val rawDNS = profileItem.remoteDNS
|
||||
?.split(",")
|
||||
?.map { it.trim() }
|
||||
?.filter { it.isNotEmpty() }
|
||||
?.ifEmpty { null }
|
||||
?: listOf(AppConfig.WIREGUARD_LOCAL_REMOTE_DNS)
|
||||
?: defaultDns
|
||||
|
||||
val remotes = if (MmkvManager.decodeSettingsBool(AppConfig.PREF_IPV6_ENABLED) == true) {
|
||||
rawDNS
|
||||
} else {
|
||||
val ipv4Dns = rawDNS.filter { !it.contains(":") }
|
||||
ipv4Dns.ifEmpty { listOf(AppConfig.WIREGUARD_LOCAL_REMOTE_DNS) }
|
||||
rawDNS.filter { !it.contains(":") }
|
||||
// falling back to the IPv4 entries of the default list
|
||||
.ifEmpty { defaultDns.filter { !it.contains(":")} }
|
||||
}
|
||||
|
||||
outboundBean?.settings?.let { wireguard ->
|
||||
|
||||
Reference in new issue
Block a user