Android XRay (#840)

* Add XRay module
This commit is contained in:
albexk 2024-06-18 20:46:21 +03:00 committed by GitHub
parent a516d0e757
commit 834b504dff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 637 additions and 151 deletions

View file

@ -27,14 +27,21 @@ private const val SPLIT_TUNNEL_EXCLUDE = 2
abstract class Protocol {
abstract val statistics: Statistics
protected lateinit var context: Context
protected lateinit var state: MutableStateFlow<ProtocolState>
protected lateinit var onError: (String) -> Unit
protected var isInitialized: Boolean = false
open fun initialize(context: Context, state: MutableStateFlow<ProtocolState>, onError: (String) -> Unit) {
fun initialize(context: Context, state: MutableStateFlow<ProtocolState>, onError: (String) -> Unit) {
this.context = context
this.state = state
this.onError = onError
internalInit()
isInitialized = true
}
protected abstract fun internalInit()
abstract fun startVpn(config: JSONObject, vpnBuilder: Builder, protect: (Int) -> Boolean)
abstract fun stopVpn()