Commit abbfe4a0 authored by Mygod's avatar Mygod

Clean up code

parent ebee665f
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
package com.github.shadowsocks.bg package com.github.shadowsocks.bg
import android.content.Context import android.content.Context
import android.util.Base64
import com.github.shadowsocks.Core
import com.github.shadowsocks.acl.Acl import com.github.shadowsocks.acl.Acl
import com.github.shadowsocks.acl.AclSyncer import com.github.shadowsocks.acl.AclSyncer
import com.github.shadowsocks.database.Profile import com.github.shadowsocks.database.Profile
...@@ -30,16 +28,13 @@ import com.github.shadowsocks.plugin.PluginConfiguration ...@@ -30,16 +28,13 @@ import com.github.shadowsocks.plugin.PluginConfiguration
import com.github.shadowsocks.plugin.PluginManager import com.github.shadowsocks.plugin.PluginManager
import com.github.shadowsocks.preference.DataStore import com.github.shadowsocks.preference.DataStore
import com.github.shadowsocks.utils.parseNumericAddress import com.github.shadowsocks.utils.parseNumericAddress
import com.github.shadowsocks.utils.signaturesCompat
import com.github.shadowsocks.utils.useCancellable
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import org.json.JSONArray
import kotlinx.coroutines.withContext
import java.io.File import java.io.File
import java.io.IOException import java.io.IOException
import java.net.* import java.net.URI
import java.security.MessageDigest import java.net.URISyntaxException
import org.json.JSONArray import java.net.UnknownHostException
/** /**
* This class sets up environment for ss-local. * This class sets up environment for ss-local.
...@@ -48,7 +43,6 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro ...@@ -48,7 +43,6 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
private var configFile: File? = null private var configFile: File? = null
var trafficMonitor: TrafficMonitor? = null var trafficMonitor: TrafficMonitor? = null
val plugin by lazy { PluginManager.init(PluginConfiguration(profile.plugin ?: "")) } val plugin by lazy { PluginManager.init(PluginConfiguration(profile.plugin ?: "")) }
private var scheduleConfigUpdate = false
suspend fun init(service: BaseService.Interface) { suspend fun init(service: BaseService.Interface) {
// it's hard to resolve DNS on a specific interface so we'll do it here // it's hard to resolve DNS on a specific interface so we'll do it here
......
...@@ -54,7 +54,7 @@ data class Profile( ...@@ -54,7 +54,7 @@ data class Profile(
// user configurable fields // user configurable fields
var name: String? = "", var name: String? = "",
var host: String = sponsored, var host: String = "example.shadowsocks.org",
var remotePort: Int = 8388, var remotePort: Int = 8388,
var password: String = "u1rRWTssNv0p", var password: String = "u1rRWTssNv0p",
var method: String = "aes-256-cfb", var method: String = "aes-256-cfb",
...@@ -101,7 +101,6 @@ data class Profile( ...@@ -101,7 +101,6 @@ data class Profile(
companion object { companion object {
private const val serialVersionUID = 1L private const val serialVersionUID = 1L
private const val sponsored = "example.shadowsocks.org"
private val pattern = private val pattern =
"""(?i)ss://[-a-zA-Z0-9+&@#/%?=.~*'()|!:,;_\[\]]*[-a-zA-Z0-9+&@#/%=.~*'()|\[\]]""".toRegex() """(?i)ss://[-a-zA-Z0-9+&@#/%?=.~*'()|!:,;_\[\]]*[-a-zA-Z0-9+&@#/%=.~*'()|\[\]]""".toRegex()
private val userInfoPattern = "^(.+?):(.*)$".toRegex() private val userInfoPattern = "^(.+?):(.*)$".toRegex()
...@@ -339,8 +338,6 @@ data class Profile( ...@@ -339,8 +338,6 @@ data class Profile(
if (fallback != null && fallback.plugin.isNullOrEmpty()) fallback.toJson().also { put("udp_fallback", it) } if (fallback != null && fallback.plugin.isNullOrEmpty()) fallback.toJson().also { put("udp_fallback", it) }
} }
val isSponsored get() = host == sponsored
fun serialize() { fun serialize() {
DataStore.editingId = id DataStore.editingId = id
DataStore.privateStore.putString(Key.name, name) DataStore.privateStore.putString(Key.name, name)
......
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