mirror of
https://github.com/MatsuriDayo/NekoBoxForAndroid.git
synced 2025-12-18 22:20:06 +08:00
fix: Certain single-label domain names can only be resolved by InetAddress.getAllByName() but not Network.getAllByName() (#1050)
This commit is contained in:
parent
2d32653f5b
commit
596b9ebfbb
@ -128,11 +128,11 @@ object LocalResolverImpl : LocalDNSTransport {
|
||||
// 老版本系统,继续用阻塞的 InetAddress
|
||||
try {
|
||||
val u = SagerNet.underlyingNetwork
|
||||
val answer = if (u != null) {
|
||||
u.getAllByName(domain)
|
||||
} else {
|
||||
InetAddress.getAllByName(domain)
|
||||
}
|
||||
val answer = try {
|
||||
u?.getAllByName(domain)
|
||||
} catch (e: UnknownHostException) {
|
||||
null
|
||||
} ?: InetAddress.getAllByName(domain)
|
||||
if (answer != null) {
|
||||
ctx.success(answer.mapNotNull { it.hostAddress }.joinToString("\n"))
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user