Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
Circulo for Android
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
Circulo App Project
Circulo for Android
Commits
955c5a31
Commit
955c5a31
authored
1 month ago
by
Nathan Freitas
Browse files
Options
Downloads
Patches
Plain Diff
update DoH support to use Cloudflare and extend timeouts
parent
1510e35e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#1638484551
failed
1 month ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/src/main/java/info/guardianproject/keanu/core/MatrixNetworkInterceptor.kt
+13
-7
13 additions, 7 deletions
...fo/guardianproject/keanu/core/MatrixNetworkInterceptor.kt
with
13 additions
and
7 deletions
app/src/main/java/info/guardianproject/keanu/core/MatrixNetworkInterceptor.kt
+
13
−
7
View file @
955c5a31
...
...
@@ -9,27 +9,33 @@ import okhttp3.Response
import
okhttp3.dnsoverhttps.DnsOverHttps
import
java.io.File
import
java.net.InetAddress
import
java.util.concurrent.TimeUnit
open
class
MatrixNetworkInterceptor
:
Interceptor
{
private
var
doh
Goog
:
Dns
private
var
doh
Client
:
OkHttpClient
private
var
doh
Client
:
Dns
private
var
ok
Client
:
OkHttpClient
init
{
//initialize DNS over HTTPS client using Google DNS
val
appCache
=
Cache
(
File
(
"cacheDir"
,
"okhttpcache"
),
10
*
1024
*
1024
)
val
bootstrapClient
=
OkHttpClient
.
Builder
().
cache
(
appCache
).
build
()
doh
Goog
=
DnsOverHttps
.
Builder
().
client
(
bootstrapClient
)
.
url
(
"https://
dns.google
/dns-query"
.
toHttpUrl
())
.
bootstrapDnsHosts
(
InetAddress
.
getByName
(
"
8.8.4.4"
),
InetAddress
.
getByName
(
"8.8.8.8
"
))
doh
Client
=
DnsOverHttps
.
Builder
().
client
(
bootstrapClient
)
.
url
(
"https://
1.1.1.1
/dns-query"
.
toHttpUrl
())
.
bootstrapDnsHosts
(
InetAddress
.
getByName
(
"
1.1.1.1
"
))
.
build
()
dohClient
=
OkHttpClient
.
Builder
().
dns
(
dohGoog
).
build
()
okClient
=
OkHttpClient
.
Builder
()
.
dns
(
dohClient
)
.
connectTimeout
(
1
,
TimeUnit
.
MINUTES
)
.
readTimeout
(
30
,
TimeUnit
.
SECONDS
)
.
writeTimeout
(
15
,
TimeUnit
.
SECONDS
)
.
build
()
}
override
fun
intercept
(
chain
:
Interceptor
.
Chain
):
Response
{
val
response
=
doh
Client
.
newCall
(
request
=
chain
.
request
()).
execute
()
val
response
=
ok
Client
.
newCall
(
request
=
chain
.
request
()).
execute
()
return
response
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment