File tree 2 files changed +40
-0
lines changed
tunnel/src/main/java/com/wireguard/android/backend
2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,28 @@ public interface Backend {
52
52
*/
53
53
String getVersion () throws Exception ;
54
54
55
+ /**
56
+ * Determines whether the service is running in always-on VPN mode.
57
+ * In this mode the system ensures that the service is always running by restarting it when necessary,
58
+ * e.g. after reboot.
59
+ *
60
+ * @returns A boolean indicating whether the service is running in always-on VPN mode.
61
+ * @throws Exception Exception raised while retrieving the always-on status.
62
+ */
63
+
64
+ boolean isAlwaysOn () throws Exception ;
65
+
66
+ /**
67
+ * Determines whether the service is running in always-on VPN lockdown mode.
68
+ * In this mode the system ensures that the service is always running and that the apps
69
+ * aren't allowed to bypass the VPN.
70
+ *
71
+ * @returns A boolean indicating whether the service is running in always-on VPN lockdown mode.
72
+ * @throws Exception Exception raised while retrieving the lockdown status.
73
+ */
74
+
75
+ boolean isLockdownEnabled () throws Exception ;
76
+
55
77
/**
56
78
* Set the state of a tunnel, updating it's configuration. If the tunnel is already up, config
57
79
* may update the running configuration; config may be null when setting the tunnel down.
Original file line number Diff line number Diff line change @@ -188,6 +188,24 @@ public String getVersion() {
188
188
return wgVersion ();
189
189
}
190
190
191
+ /**
192
+ * Determines if the service is running in always-on VPN mode.
193
+ * @return {@link boolean} whether the service is running in always-on VPN mode.
194
+ */
195
+ @ Override
196
+ public boolean isAlwaysOn () {
197
+ return vpnService .get (0 , TimeUnit .NANOSECONDS ).isAlwaysOn ();
198
+ }
199
+
200
+ /**
201
+ * Determines if the service is running in always-on VPN lockdown mode.
202
+ * @return {@link boolean} whether the service is running in always-on VPN lockdown mode.
203
+ */
204
+ @ Override
205
+ public boolean isLockdownEnabled () {
206
+ return vpnService .get (0 , TimeUnit .NANOSECONDS ).isLockdownEnabled ();
207
+ }
208
+
191
209
/**
192
210
* Change the state of a given {@link Tunnel}, optionally applying a given {@link Config}.
193
211
*
You can’t perform that action at this time.
0 commit comments