diff options
author | Samuel Holland <samuel@sholland.org> | 2018-09-05 18:33:42 -0500 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2018-11-11 21:50:23 -0600 |
commit | a264f7ab36bf1335999d53cb4a0d753c54b231d0 (patch) | |
tree | 8adb020e43111ff0420569c16c8c529f69b6a0e5 /app/src/main/java/com/wireguard/android/backend | |
parent | tools: wg-quick: bump (diff) | |
download | wireguard-android-a264f7ab36bf1335999d53cb4a0d753c54b231d0.tar.xz wireguard-android-a264f7ab36bf1335999d53cb4a0d753c54b231d0.zip |
Auto-format the source directories
Blame Jason for writing Java in vim.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main/java/com/wireguard/android/backend')
3 files changed, 33 insertions, 27 deletions
diff --git a/app/src/main/java/com/wireguard/android/backend/Backend.java b/app/src/main/java/com/wireguard/android/backend/Backend.java index 000a572a..64bb3d02 100644 --- a/app/src/main/java/com/wireguard/android/backend/Backend.java +++ b/app/src/main/java/com/wireguard/android/backend/Backend.java @@ -53,14 +53,11 @@ public interface Backend { Statistics getStatistics(Tunnel tunnel) throws Exception; /** - * Set the state of a tunnel. + * Determine type name of underlying backend. * - * @param tunnel The tunnel to control the state of. - * @param state The new state for this tunnel. Must be {@code UP}, {@code DOWN}, or - * {@code TOGGLE}. - * @return The updated state of the tunnel. + * @return Type name */ - State setState(Tunnel tunnel, State state) throws Exception; + String getTypeName(); /** * Determine version of underlying backend. @@ -71,9 +68,12 @@ public interface Backend { String getVersion() throws Exception; /** - * Determine type name of underlying backend. + * Set the state of a tunnel. * - * @return Type name + * @param tunnel The tunnel to control the state of. + * @param state The new state for this tunnel. Must be {@code UP}, {@code DOWN}, or + * {@code TOGGLE}. + * @return The updated state of the tunnel. */ - String getTypeName(); + State setState(Tunnel tunnel, State state) throws Exception; } diff --git a/app/src/main/java/com/wireguard/android/backend/GoBackend.java b/app/src/main/java/com/wireguard/android/backend/GoBackend.java index 0d21c599..295df9d0 100644 --- a/app/src/main/java/com/wireguard/android/backend/GoBackend.java +++ b/app/src/main/java/com/wireguard/android/backend/GoBackend.java @@ -60,12 +60,6 @@ public final class GoBackend implements Backend { private static native String wgVersion(); @Override - public String getVersion() { return wgVersion(); } - - @Override - public String getTypeName() { return "Go userspace"; } - - @Override public Config applyConfig(final Tunnel tunnel, final Config config) throws Exception { if (tunnel.getState() == State.UP) { // Restart the tunnel to apply the new config. @@ -102,6 +96,16 @@ public final class GoBackend implements Backend { } @Override + public String getTypeName() { + return "Go userspace"; + } + + @Override + public String getVersion() { + return wgVersion(); + } + + @Override public State setState(final Tunnel tunnel, State state) throws Exception { final State originalState = getState(tunnel); if (state == State.TOGGLE) diff --git a/app/src/main/java/com/wireguard/android/backend/WgQuickBackend.java b/app/src/main/java/com/wireguard/android/backend/WgQuickBackend.java index a4edfc27..bfc363a4 100644 --- a/app/src/main/java/com/wireguard/android/backend/WgQuickBackend.java +++ b/app/src/main/java/com/wireguard/android/backend/WgQuickBackend.java @@ -41,18 +41,6 @@ public final class WgQuickBackend implements Backend { } @Override - public String getVersion() throws Exception { - final List<String> output = new ArrayList<>(); - if (Application.getRootShell() - .run(output, "cat /sys/module/wireguard/version") != 0 || output.isEmpty()) - throw new Exception("Unable to determine kernel module version"); - return output.get(0); - } - - @Override - public String getTypeName() { return "Kernel module"; } - - @Override public Config applyConfig(final Tunnel tunnel, final Config config) throws Exception { if (tunnel.getState() == State.UP) { // Restart the tunnel to apply the new config. @@ -95,6 +83,20 @@ public final class WgQuickBackend implements Backend { } @Override + public String getTypeName() { + return "Kernel module"; + } + + @Override + public String getVersion() throws Exception { + final List<String> output = new ArrayList<>(); + if (Application.getRootShell() + .run(output, "cat /sys/module/wireguard/version") != 0 || output.isEmpty()) + throw new Exception("Unable to determine kernel module version"); + return output.get(0); + } + + @Override public State setState(final Tunnel tunnel, State state) throws Exception { final State originalState = getState(tunnel); if (state == State.TOGGLE) |