Commit 288f1a99 authored by Mygod's avatar Mygod

Check crypto before init

parent 39f784a9
......@@ -41,6 +41,12 @@ import java.net.UnknownHostException
* This class sets up environment for ss-local.
*/
class ProxyInstance(val profile: Profile, private val route: String = profile.route) {
init {
// check the crypto
require(profile.method !in arrayOf("aes-192-gcm", "chacha20", "salsa20")) {
"cipher ${profile.method} is deprecated."
}
}
private var configFile: File? = null
var trafficMonitor: TrafficMonitor? = null
val plugin by lazy { PluginManager.init(PluginConfiguration(profile.plugin ?: "")) }
......@@ -54,15 +60,6 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
throw UnknownHostException().initCause(e)
}?.hostAddress ?: throw UnknownHostException()
}
// check the crypto
val deprecatedCiphers
= arrayOf("aes-192-gcm", "chacha20", "salsa20")
for (c in deprecatedCiphers)
{
if (profile.method == c) {
throw IllegalArgumentException("cipher $c is deprecated.")
}
}
}
/**
......
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