Add AWG module
This commit is contained in:
parent
91f44fb394
commit
9297f877c4
11 changed files with 295 additions and 43 deletions
|
|
@ -18,17 +18,17 @@ private const val TAG = "Protocol"
|
|||
|
||||
const val VPN_SESSION_NAME = "AmneziaVPN"
|
||||
|
||||
abstract class Protocol(protected val context: Context) {
|
||||
|
||||
open lateinit var config: ProtocolConfig
|
||||
abstract class Protocol {
|
||||
|
||||
abstract val statistics: Statistics
|
||||
|
||||
abstract fun initialize()
|
||||
abstract fun initialize(context: Context)
|
||||
|
||||
abstract fun parseConfig(config: JSONObject)
|
||||
abstract fun startVpn(config: JSONObject, vpnBuilder: Builder, protect: (Int) -> Boolean)
|
||||
|
||||
protected open fun buildVpnInterface(vpnBuilder: Builder) {
|
||||
abstract fun stopVpn()
|
||||
|
||||
protected open fun buildVpnInterface(config: ProtocolConfig, vpnBuilder: Builder) {
|
||||
vpnBuilder.setSession(VPN_SESSION_NAME)
|
||||
vpnBuilder.allowFamily(OsConstants.AF_INET)
|
||||
vpnBuilder.allowFamily(OsConstants.AF_INET6)
|
||||
|
|
@ -49,10 +49,6 @@ abstract class Protocol(protected val context: Context) {
|
|||
vpnBuilder.setMetered(false)
|
||||
}
|
||||
|
||||
abstract fun startVpn(vpnBuilder: Builder, protect: (Int) -> Boolean)
|
||||
|
||||
abstract fun stopVpn()
|
||||
|
||||
companion object {
|
||||
private fun extractLibrary(context: Context, libraryName: String, destination: File): Boolean {
|
||||
Log.d(TAG, "Extracting library: $libraryName")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue