Commit 5d449fca authored by chenhuaqing's avatar chenhuaqing Committed by hanakeichen

add `dnsServer` field

parent b53fd3fa
......@@ -18,4 +18,5 @@ data class GameInfo(
val packageName: String,
val boosterPackageName :String,
val proxyRules: String,
val dnsServer: String,
)
\ No newline at end of file
......@@ -207,6 +207,7 @@ object AcceleratorUtils : TencentLocationListener {
}
}
DataStore.proxyRules = game.proxyRules
DataStore.dnsServer = game.dnsServer
val serverPort = game.boosterServer.split(":")
DataStore.pingAccHost = serverPort[0]
......
......@@ -16,10 +16,15 @@ object AccVpn {
fun writeConfig(context: Context, tunFd: Int, profile: Profile) {
val proxyRules = DataStore.proxyRules
val dnsServer = if (DataStore.dnsServer.isNotBlank()) {
DataStore.dnsServer
} else {
"8.8.8.8"
}
val configContent = """
[General]
loglevel = trace
dns-server = 8.8.8.8
dns-server = $dnsServer
tun-fd = $tunFd
[Proxy]
Direct = direct
......
......@@ -134,4 +134,7 @@ object DataStore : OnPreferenceDataStoreChangeListener {
var proxyRules: String
get() = privateStore.getString(Key.proxyRules) ?: ""
set(value) = privateStore.putString(Key.proxyRules, value)
var dnsServer: String
get() = privateStore.getString(Key.dnsServer) ?: ""
set(value) = privateStore.putString(Key.dnsServer, value)
}
......@@ -80,6 +80,7 @@ object Key {
const val pingNetReachableHost = "pingNetReachableHost"
const val proxyRules = "proxyRules"
const val dnsServer = "dnsServer"
// TV specific values
const val controlStats = "control.stats"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment