mirror of
https://github.com/MatsuriDayo/NekoBoxForAndroid.git
synced 2025-12-19 22:50:05 +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
|
// 老版本系统,继续用阻塞的 InetAddress
|
||||||
try {
|
try {
|
||||||
val u = SagerNet.underlyingNetwork
|
val u = SagerNet.underlyingNetwork
|
||||||
val answer = if (u != null) {
|
val answer = try {
|
||||||
u.getAllByName(domain)
|
u?.getAllByName(domain)
|
||||||
} else {
|
} catch (e: UnknownHostException) {
|
||||||
InetAddress.getAllByName(domain)
|
null
|
||||||
}
|
} ?: InetAddress.getAllByName(domain)
|
||||||
if (answer != null) {
|
if (answer != null) {
|
||||||
ctx.success(answer.mapNotNull { it.hostAddress }.joinToString("\n"))
|
ctx.success(answer.mapNotNull { it.hostAddress }.joinToString("\n"))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user