Skip to content

Commit

Permalink
Bump version 5.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrlive committed May 6, 2023
1 parent a11f50f commit 3cbb969
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ ext {
sdkVersion = 33
compileSdkVersion = 33
buildToolsVersion = '31.0.0'
versionCode = 519
versionName = '5.1.9'
versionCode = 520
versionName = '5.2.0'
resConfigs = ['zh-rCN']
}

Expand Down
8 changes: 6 additions & 2 deletions core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,14 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
*/
fun start(service: BaseService.Interface, stat: File, configFile: File, extraFlag: String? = null) {
trafficMonitor = TrafficMonitor(stat)
val isOverTLS = DataStore.useOverTLS && profile.isOverTLS()

this.configFile = configFile
val config = profile.toJson()
val config = if (isOverTLS) {
profile.toOverTlsJson()
} else {
profile.toJson()
}

configFile.writeText(config.toString())

Expand All @@ -97,7 +102,6 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
if (DataStore.tcpFastOpen) cmd += "--fast-open"
if (BuildConfig.DEBUG) cmd += "-v"

val isOverTLS = DataStore.useOverTLS && profile.isOverTLS()
myThread = SsrClientThread(service as VpnService, isOverTLS, cmd)
myThread?.start()
}
Expand Down
14 changes: 14 additions & 0 deletions core/src/main/java/com/github/shadowsocks/database/Profile.kt
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,20 @@ data class Profile(
fun isOverTLS() : Boolean =
over_tls_enable && method == "none" && obfs == "plain" && protocol == "origin"

fun toOverTlsJson(profiles: LongSparseArray<Profile>? = null): JSONObject = JSONObject().apply {
put("remarks", name)
put("method", method)
put("password", password)
put("tunnel_path", over_tls_path)
put("client_settings", JSONObject().apply {
put("server_host", host)
put("server_port", remotePort)
put("server_domain", over_tls_server_domain)
put("listen_host", DataStore.listenAddress)
put("listen_port", DataStore.portProxy)
})
}

fun toJson(profiles: LongSparseArray<Profile>? = null): JSONObject = JSONObject().apply {
put("server", host)
put("server_port", remotePort)
Expand Down
2 changes: 1 addition & 1 deletion rust/overtls

0 comments on commit 3cbb969

Please sign in to comment.