Skip to content

Commit

Permalink
Update cloudflare GET example (square#4097)
Browse files Browse the repository at this point in the history
* Update cloudflare GET example

* add IP example
  • Loading branch information
yschimke authored and swankjesse committed Jun 29, 2018
1 parent 8fc6748 commit aa58436
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ static DnsOverHttps buildGoogle(OkHttpClient bootstrapClient) {
}

static DnsOverHttps buildGooglePost(OkHttpClient bootstrapClient) {

return new DnsOverHttps.Builder().client(bootstrapClient)
.url(parseUrl("https://dns.google.com/experimental"))
.bootstrapDnsHosts(getByIp("216.58.204.78"), getByIp("2a00:1450:4009:814:0:0:0:200e"))
Expand All @@ -48,23 +47,28 @@ static DnsOverHttps buildGooglePost(OkHttpClient bootstrapClient) {
.build();
}

static DnsOverHttps buildCloudflare(OkHttpClient bootstrapClient) {
static DnsOverHttps buildCloudflareIp(OkHttpClient bootstrapClient) {
return new DnsOverHttps.Builder().client(bootstrapClient)
.url(parseUrl("https://1.1.1.1/dns-query"))
.includeIPv6(false)
.build();
}

static DnsOverHttps buildCloudflare(OkHttpClient bootstrapClient) {
return new DnsOverHttps.Builder().client(bootstrapClient)
.url(parseUrl("https://cloudflare-dns.com/dns-query?ct=application/dns-udpwireformat"))
.bootstrapDnsHosts(getByIp("104.16.111.25"), getByIp("104.16.112.25"),
getByIp("2400:cb00:2048:1:0:0:6810:7019"), getByIp("2400:cb00:2048:1:0:0:6810:6f19"))
.url(parseUrl("https://cloudflare-dns.com/dns-query"))
.bootstrapDnsHosts(getByIp("1.1.1.1"))
.includeIPv6(false)
.build();
}

static DnsOverHttps buildCloudflarePost(OkHttpClient bootstrapClient) {

return new DnsOverHttps.Builder().client(bootstrapClient)
.url(parseUrl("https://dns.cloudflare.com/.well-known/dns-query"))
.url(parseUrl("https://cloudflare-dns.com/dns-query?ct=application/dns-udpwireformat"))
.bootstrapDnsHosts(getByIp("104.16.111.25"), getByIp("104.16.112.25"),
getByIp("2400:cb00:2048:1:0:0:6810:7019"), getByIp("2400:cb00:2048:1:0:0:6810:6f19"))
.includeIPv6(false)
.post(true)
.contentType(UDPWIREFORMAT)
.build();
}

Expand Down Expand Up @@ -99,6 +103,7 @@ public static List<DnsOverHttps> providers(OkHttpClient client, boolean http2Onl
result.add(buildGooglePost(client));
}
result.add(buildCloudflare(client));
result.add(buildCloudflareIp(client));
if (!getOnly) {
result.add(buildCloudflarePost(client));
}
Expand Down

0 comments on commit aa58436

Please sign in to comment.