Skip to content

Commit bf74a26

Browse files
committed
Vpn service inheritance possibility
1 parent 09b75c2 commit bf74a26

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* WireGuard tunnels.
4040
*/
4141
@NonNullForAll
42-
public final class GoBackend implements Backend {
42+
public class GoBackend implements Backend {
4343
private static final int DNS_RESOLUTION_RETRIES = 10;
4444
private static final String TAG = "WireGuard/GoBackend";
4545
@Nullable private static AlwaysOnCallback alwaysOnCallback;
@@ -240,6 +240,10 @@ public State setState(final Tunnel tunnel, State state, @Nullable final Config c
240240
return getState(tunnel);
241241
}
242242

243+
protected Class<? extends VpnService> getVpnServiceClass() {
244+
return VpnService.class;
245+
}
246+
243247
private void setStateInternal(final Tunnel tunnel, @Nullable final Config config, final State state)
244248
throws Exception {
245249
Log.i(TAG, "Bringing tunnel " + tunnel.getName() + ' ' + state);
@@ -254,7 +258,7 @@ private void setStateInternal(final Tunnel tunnel, @Nullable final Config config
254258
final VpnService service;
255259
if (!vpnService.isDone()) {
256260
Log.d(TAG, "Requesting to start VpnService");
257-
context.startService(new Intent(context, VpnService.class));
261+
context.startService(new Intent(context, getVpnServiceClass()));
258262
}
259263

260264
try {

0 commit comments

Comments
 (0)