1
0
mirror of https://github.com/square/okhttp.git synced 2026-01-25 16:01:38 +03:00
Files
okhttp/okhttp-dnsoverhttps
Yuri Schimke 7f3a220877 Switch to Dokka v2 (#9263)
* Update Dokka to v2

update configuration to use experimental V2 plugin mode and adjust documentation generation scripts.
2026-01-25 12:37:13 +00:00
..
2026-01-25 12:37:13 +00:00
2025-10-30 17:39:59 -04:00

OkHttp DNS over HTTPS Implementation

This module is an implementation of DNS over HTTPS using OkHttp.

Download

testImplementation("com.squareup.okhttp3:okhttp-dnsoverhttps:5.3.0")

Usage

  val appCache = Cache(File("cacheDir", "okhttpcache"), 10 * 1024 * 1024)
  val bootstrapClient = OkHttpClient.Builder().cache(appCache).build()

  val dns = DnsOverHttps.Builder().client(bootstrapClient)
    .url("https://dns.google/dns-query".toHttpUrl())
    .bootstrapDnsHosts(InetAddress.getByName("8.8.4.4"), InetAddress.getByName("8.8.8.8"))
    .build()

  val client = bootstrapClient.newBuilder().dns(dns).build()