Commit 3fac8c07 authored by sheteng's avatar sheteng

Merge remote-tracking branch 'origin/cc-dev' into cc-dev

parents ead1ad79 5d449fca
...@@ -18,4 +18,5 @@ data class GameInfo( ...@@ -18,4 +18,5 @@ data class GameInfo(
val packageName: String, val packageName: String,
val boosterPackageName :String, val boosterPackageName :String,
val proxyRules: String, val proxyRules: String,
val dnsServer: String,
) )
\ No newline at end of file
...@@ -211,6 +211,7 @@ object AcceleratorUtils : TencentLocationListener { ...@@ -211,6 +211,7 @@ object AcceleratorUtils : TencentLocationListener {
} }
} }
DataStore.proxyRules = game.proxyRules DataStore.proxyRules = game.proxyRules
DataStore.dnsServer = game.dnsServer
val serverPort = game.boosterServer.split(":") val serverPort = game.boosterServer.split(":")
DataStore.pingAccHost = serverPort[0] DataStore.pingAccHost = serverPort[0]
......
...@@ -16,10 +16,15 @@ object AccVpn { ...@@ -16,10 +16,15 @@ object AccVpn {
fun writeConfig(context: Context, tunFd: Int, profile: Profile) { fun writeConfig(context: Context, tunFd: Int, profile: Profile) {
val proxyRules = DataStore.proxyRules val proxyRules = DataStore.proxyRules
val dnsServer = if (DataStore.dnsServer.isNotBlank()) {
DataStore.dnsServer
} else {
"8.8.8.8"
}
val configContent = """ val configContent = """
[General] [General]
loglevel = trace loglevel = trace
dns-server = 8.8.8.8 dns-server = $dnsServer
tun-fd = $tunFd tun-fd = $tunFd
[Proxy] [Proxy]
Direct = direct Direct = direct
......
...@@ -134,4 +134,7 @@ object DataStore : OnPreferenceDataStoreChangeListener { ...@@ -134,4 +134,7 @@ object DataStore : OnPreferenceDataStoreChangeListener {
var proxyRules: String var proxyRules: String
get() = privateStore.getString(Key.proxyRules) ?: "" get() = privateStore.getString(Key.proxyRules) ?: ""
set(value) = privateStore.putString(Key.proxyRules, value) 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 { ...@@ -80,6 +80,7 @@ object Key {
const val pingNetReachableHost = "pingNetReachableHost" const val pingNetReachableHost = "pingNetReachableHost"
const val proxyRules = "proxyRules" const val proxyRules = "proxyRules"
const val dnsServer = "dnsServer"
// TV specific values // TV specific values
const val controlStats = "control.stats" 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