Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
a17908f6
Commit
a17908f6
authored
Jun 03, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only resolve via DoH for specific hostnames
parent
cb7148a2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
14 deletions
+26
-14
build.gradle
app/build.gradle
+1
-0
NetworkingModule.kt
...src/main/java/com/topjohnwu/magisk/di/NetworkingModule.kt
+25
-14
No files found.
app/build.gradle
View file @
a17908f6
...
...
@@ -54,6 +54,7 @@ android {
exclude
'/org/bouncycastle/**'
exclude
'/kotlin/**'
exclude
'/kotlinx/**'
exclude
'/okhttp3/**'
}
kotlinOptions
{
...
...
app/src/main/java/com/topjohnwu/magisk/di/NetworkingModule.kt
View file @
a17908f6
...
...
@@ -12,6 +12,7 @@ import io.noties.markwon.Markwon
import
io.noties.markwon.html.HtmlPlugin
import
io.noties.markwon.image.ImagesPlugin
import
io.noties.markwon.image.network.OkHttpNetworkSchemeHandler
import
okhttp3.Dns
import
okhttp3.HttpUrl
import
okhttp3.OkHttpClient
import
okhttp3.dnsoverhttps.DnsOverHttps
...
...
@@ -46,20 +47,30 @@ fun createOkHttpClient(context: Context): OkHttpClient {
builder
.
sslSocketFactory
(
NoSSLv3SocketFactory
())
}
builder
.
dns
(
DnsOverHttps
.
Builder
().
client
(
builder
.
build
())
.
url
(
HttpUrl
.
get
(
"https://cloudflare-dns.com/dns-query"
))
.
bootstrapDnsHosts
(
listOf
(
InetAddress
.
getByName
(
"162.159.36.1"
),
InetAddress
.
getByName
(
"162.159.46.1"
),
InetAddress
.
getByName
(
"1.1.1.1"
),
InetAddress
.
getByName
(
"1.0.0.1"
),
InetAddress
.
getByName
(
"162.159.132.53"
),
InetAddress
.
getByName
(
"2606:4700:4700::1111"
),
InetAddress
.
getByName
(
"2606:4700:4700::1001"
),
InetAddress
.
getByName
(
"2606:4700:4700::0064"
),
InetAddress
.
getByName
(
"2606:4700:4700::6400"
)
))
.
build
())
val
doh
=
DnsOverHttps
.
Builder
().
client
(
builder
.
build
())
.
url
(
HttpUrl
.
get
(
"https://cloudflare-dns.com/dns-query"
))
.
bootstrapDnsHosts
(
listOf
(
InetAddress
.
getByName
(
"162.159.36.1"
),
InetAddress
.
getByName
(
"162.159.46.1"
),
InetAddress
.
getByName
(
"1.1.1.1"
),
InetAddress
.
getByName
(
"1.0.0.1"
),
InetAddress
.
getByName
(
"162.159.132.53"
),
InetAddress
.
getByName
(
"2606:4700:4700::1111"
),
InetAddress
.
getByName
(
"2606:4700:4700::1001"
),
InetAddress
.
getByName
(
"2606:4700:4700::0064"
),
InetAddress
.
getByName
(
"2606:4700:4700::6400"
)
))
.
resolvePrivateAddresses
(
true
)
/* To make PublicSuffixDatabase never used */
.
build
()
builder
.
dns
{
hostname
->
// Only resolve via DoH for known DNS polluted hostnames
if
(
hostname
==
"raw.githubusercontent.com"
)
{
doh
.
lookup
(
hostname
)
}
else
{
Dns
.
SYSTEM
.
lookup
(
hostname
)
}
}
return
builder
.
build
()
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment