aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt')
-rw-r--r--app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt b/app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt
index ac68c9f..af5966e 100644
--- a/app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt
+++ b/app/src/main/java/org/pacien/tincapp/service/TincVpnService.kt
@@ -1,6 +1,6 @@
1/* 1/*
2 * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon 2 * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon
3 * Copyright (C) 2017-2020 Pacien TRAN-GIRARD 3 * Copyright (C) 2017-2023 Pacien TRAN-GIRARD
4 * 4 *
5 * This program is free software: you can redistribute it and/or modify 5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -23,6 +23,7 @@ import android.content.Context
23import android.content.Intent 23import android.content.Intent
24import android.net.LocalServerSocket 24import android.net.LocalServerSocket
25import android.net.VpnService 25import android.net.VpnService
26import android.os.Build
26import android.os.ParcelFileDescriptor 27import android.os.ParcelFileDescriptor
27import androidx.localbroadcastmanager.content.LocalBroadcastManager 28import androidx.localbroadcastmanager.content.LocalBroadcastManager
28import java8.util.concurrent.CompletableFuture 29import java8.util.concurrent.CompletableFuture
@@ -133,6 +134,8 @@ class TincVpnService : VpnService() {
133 Builder().setSession(netName) 134 Builder().setSession(netName)
134 .applyCfg(interfaceCfg) 135 .applyCfg(interfaceCfg)
135 .also { applyIgnoringException(it::addDisallowedApplication, BuildConfig.APPLICATION_ID) } 136 .also { applyIgnoringException(it::addDisallowedApplication, BuildConfig.APPLICATION_ID) }
137 // inherit metered property from underlying network
138 .also { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) it.setMetered(false) }
136 .establish()!! 139 .establish()!!
137 } catch (e: IllegalArgumentException) { 140 } catch (e: IllegalArgumentException) {
138 return reportError(resources.getString(R.string.notification_error_message_network_config_invalid_format, e.defaultMessage()), e, "network-interface") 141 return reportError(resources.getString(R.string.notification_error_message_network_config_invalid_format, e.defaultMessage()), e, "network-interface")