aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/org/pacien/tincapp/service/VpnInterfaceConfiguraton.kt
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/org/pacien/tincapp/service/VpnInterfaceConfiguraton.kt')
-rw-r--r--app/src/main/java/org/pacien/tincapp/service/VpnInterfaceConfiguraton.kt28
1 files changed, 17 insertions, 11 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/service/VpnInterfaceConfiguraton.kt b/app/src/main/java/org/pacien/tincapp/service/VpnInterfaceConfiguraton.kt
index 520d68c..50ccb20 100644
--- a/app/src/main/java/org/pacien/tincapp/service/VpnInterfaceConfiguraton.kt
+++ b/app/src/main/java/org/pacien/tincapp/service/VpnInterfaceConfiguraton.kt
@@ -25,19 +25,25 @@ private fun Configuration.getIntList(key: String): List<Int> = getList(Int::clas
25 25
26data class CidrAddress(val address: String, val prefix: Int) { 26data class CidrAddress(val address: String, val prefix: Int) {
27 constructor(slashSeparated: String) : 27 constructor(slashSeparated: String) :
28 this(slashSeparated.substringBefore("/"), Integer.parseInt(slashSeparated.substringAfter("/"))) 28 this(slashSeparated.substringBefore(SEPARATOR), Integer.parseInt(slashSeparated.substringAfter(SEPARATOR)))
29
30 override fun toString() = address + SEPARATOR + prefix
31
32 companion object {
33 private val SEPARATOR = "/"
34 }
29} 35}
30 36
31data class VpnInterfaceConfiguration(val addresses: List<CidrAddress>, 37data class VpnInterfaceConfiguration(val addresses: List<CidrAddress> = emptyList(),
32 val routes: List<CidrAddress>, 38 val routes: List<CidrAddress> = emptyList(),
33 val dnsServers: List<String>, 39 val dnsServers: List<String> = emptyList(),
34 val searchDomains: List<String>, 40 val searchDomains: List<String> = emptyList(),
35 val allowedApplications: List<String>, 41 val allowedApplications: List<String> = emptyList(),
36 val disallowedApplications: List<String>, 42 val disallowedApplications: List<String> = emptyList(),
37 val allowedFamilies: List<Int>, 43 val allowedFamilies: List<Int> = emptyList(),
38 val allowBypass: Boolean, 44 val allowBypass: Boolean = false,
39 val blocking: Boolean, 45 val blocking: Boolean = false,
40 val mtu: Int?) { 46 val mtu: Int? = null) {
41 47
42 constructor(cfg: Configuration) : this( 48 constructor(cfg: Configuration) : this(
43 cfg.getCidrList(KEY_ADDRESSES), 49 cfg.getCidrList(KEY_ADDRESSES),