Skip to content

DOH Error - Android app #94

@Alexander-McQuen

Description

@Alexander-McQuen

Hi

First of all - thank you so much for your amazing job on this project and we really appreciate it

I've investigated the issue where setting DoH causes data to stop transferring in some tunnel configs.

Root Cause: For tunnel types like DNSTT or NoizDNS, DNS options (UDP, TCP, DoT, DoH) are passed to the Go dnstt-client. Because the Go networking library often fails to read Android's DNS configuration natively, you implemented a resolveHost helper in Kotlin that resolves domain names to numeric IPs before passing them to Go. This was implemented correctly for UDP, TCP, and DoT.

However, for DoH (DNS-over-HTTPS), the app directly passes the URL (e.g., https://dns.google/dns-query) without resolving the hostname. When the Go client attempts to connect to dns.google, it fails to resolve the IP address, causing the data stream to silently fail.

What I suggest :

Update "formatDnsServerAddress " to resolve the dohUrl hostname to its IP address, similar to how DnsTransport.UDP, TCP, and DOT are handled.

[MODIFY] "VpnRepositoryImpl.kt"

"kotlin "

DnsTransport.DOH -> {
val urlStr = profile.dohUrl.ifBlank { "https://dns.google/dns-query" }
try {
val url = java.net.URL(urlStr)
val host = url.host
val resolvedIp = resolveHost(host)
if (resolvedIp != host && DomainRouter.isIpAddress(resolvedIp)) {
val portStr = if (url.port != -1) ":${url.port}" else ""
"${url.protocol}://$resolvedIp$portStr${url.file}"
} else {
urlStr
}
} catch (e: Exception) {
urlStr
}
}

My knowledge is very limited so I hope you don't mind my advice , hopefully it can fix the issue ,

Regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions