Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
PublicAndroidApps
Nebulo
Commits
b384aee7
Commit
b384aee7
authored
Aug 20, 2021
by
Daniel Wolf
Browse files
Use DoH for Nebulos own internal HTTP calls
parent
c10783ec
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/build.gradle
View file @
b384aee7
...
...
@@ -182,6 +182,7 @@ dependencies {
leakCanaryImplementation
'com.squareup.leakcanary:leakcanary-android:2.7'
implementation
"com.squareup.okhttp3:okhttp:4.9.1"
implementation
'com.squareup.okhttp3:okhttp-dnsoverhttps:4.9.1'
implementation
'com.github.AppIntro:AppIntro:6.0.0'
storeImplementation
'com.google.android.play:core:1.10.0'
...
...
app/src/main/java/com/frostnerd/smokescreen/Globals.kt
View file @
b384aee7
...
...
@@ -21,7 +21,11 @@ import com.frostnerd.encrypteddnstunnelproxy.quic.AbstractQuicDnsHandle
import
com.frostnerd.encrypteddnstunnelproxy.quic.QuicUpstreamAddress
import
com.frostnerd.encrypteddnstunnelproxy.tls.AbstractTLSDnsHandle
import
kotlinx.android.synthetic.main.dialog_privacypolicy.view.*
import
okhttp3.HttpUrl.Companion.toHttpUrl
import
okhttp3.OkHttpClient
import
okhttp3.dnsoverhttps.DnsOverHttps
import
okhttp3.internal.toHexString
import
java.net.InetAddress
import
java.util.*
...
...
@@ -138,4 +142,11 @@ fun createQuicEngineIfInstalled(context: Context, quicOnly:Boolean, vararg addre
return
if
(
QuicEngineImpl
.
providerInstalled
)
{
QuicEngineImpl
(
context
,
quicOnly
,
*
addresses
)
}
else
null
}
fun
okhttpClientWithDoh
():
OkHttpClient
{
val
clientForDoh
=
OkHttpClient
()
val
dns
=
DnsOverHttps
.
Builder
().
client
(
clientForDoh
).
url
(
"https://1.1.1.1/dns-query"
.
toHttpUrl
())
.
bootstrapDnsHosts
(
InetAddress
.
getByName
(
"1.1.1.1"
),
InetAddress
.
getByName
(
"1.0.0.1"
)).
build
()
return
OkHttpClient
.
Builder
().
dns
(
dns
).
build
()
}
\ No newline at end of file
app/src/main/java/com/frostnerd/smokescreen/SmokeScreen.kt
View file @
b384aee7
...
...
@@ -269,7 +269,7 @@ class SmokeScreen : Application() {
if
(
configServer
.
isNotBlank
()
&&
configServer
.
startsWith
(
"http"
)
&&
!
configServer
.
contains
(
"@"
))
{
log
(
"Dynamically retrieving Sentry DSN from $configServer"
)
val
request
=
Request
.
Builder
().
url
(
configServer
).
build
()
OkH
ttpClient
.
Builder
().
build
().
newCall
(
request
).
enqueue
(
object
:
Callback
{
okh
ttpClient
WithDoh
().
newCall
(
request
).
enqueue
(
object
:
Callback
{
override
fun
onFailure
(
call
:
Call
,
e
:
IOException
)
{
log
(
"Sentry DSN retrieval failed with error: ${e.message}"
)
}
...
...
app/src/main/java/com/frostnerd/smokescreen/service/RuleImportService.kt
View file @
b384aee7
...
...
@@ -68,7 +68,7 @@ class RuleImportService : IntentService("RuleImportService") {
}
private
val
httpClient
by
lazy
(
LazyThreadSafetyMode
.
NONE
)
{
OkH
ttpClient
()
okh
ttpClient
WithDoh
()
}
override
fun
attachBaseContext
(
newBase
:
Context
)
{
...
...
Write
Preview
Supports
Markdown
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