GoBackend: integrate into app

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld
2018-02-17 21:14:09 +01:00
parent b923f7bc57
commit 0ea6f73332
15 changed files with 348 additions and 59 deletions
@@ -88,8 +88,6 @@ public final class WgQuickBackend implements Backend {
state = originalState == State.UP ? State.DOWN : State.UP;
if (state == originalState)
return originalState;
if (state == State.UP && !new File("/sys/module/wireguard").exists())
throw new ModuleNotLoadedException("WireGuard module not loaded");
Log.d(TAG, "Changing tunnel " + tunnel.getName() + " to state " + state);
toolsInstaller.ensureToolsAvailable();
setStateInternal(tunnel, tunnel.getConfig(), state);
@@ -113,14 +111,4 @@ public final class WgQuickBackend implements Backend {
if (result != 0)
throw new Exception("Unable to configure tunnel (wg-quick returned " + result + ')');
}
public static class ModuleNotLoadedException extends Exception {
public ModuleNotLoadedException(final String message, final Throwable cause) {
super(message, cause);
}
public ModuleNotLoadedException(final String message) {
super(message);
}
}
}