https://github.com/doorbash/glider-android
use glider with okhttp
https://github.com/doorbash/glider-android
android glider okhttp proxy
Last synced: 5 days ago
JSON representation
use glider with okhttp
- Host: GitHub
- URL: https://github.com/doorbash/glider-android
- Owner: doorbash
- License: gpl-3.0
- Created: 2023-01-08T18:42:05.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-01-11T16:59:36.000Z (over 3 years ago)
- Last Synced: 2026-01-01T10:38:59.096Z (4 months ago)
- Topics: android, glider, okhttp, proxy
- Language: Java
- Homepage:
- Size: 24.6 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Glider-Android
## Download
```groovy
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.doorbash:glider-android:1.0.3'
}
```
## Usage
```kotlin
val client: OkHttpClient = OkHttpClient.Builder()
.retryOnConnectionFailure(false)
.socketFactory(GliderSocketFactory("-forward tls://api.ipify.org/ -dialtimeout 10"))
.callTimeout(20, TimeUnit.SECONDS)
.dns {
val addresses = Gliderandroid.resolve(
"-forward doh://1.1.1.1", // any proxy that supports DialUDP works
it,
"8.8.8.8",
53 // must be 53 when using doh://
).toStringList()
println("addresses: ${addresses.joinToString(", ")}")
addresses.map { address -> InetAddress.getByName(address) }
}
.build()
try {
val response = client.newCall(
Request.Builder()
.addHeader("Cache-Control", "no-cache")
.cacheControl(CacheControl.FORCE_NETWORK)
.url("http://api.ipify.org/")
.build()
).execute().body.string()
println(response)
} catch (e: Exception) {
e.printStackTrace()
}
```
## License
MIT