Auto-format the source directories
Blame Jason for writing Java in vim. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -59,12 +59,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) {
|
||||
@@ -101,6 +95,16 @@ public final class GoBackend implements Backend {
|
||||
return new Statistics();
|
||||
}
|
||||
|
||||
@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);
|
||||
|
||||
@@ -40,18 +40,6 @@ public final class WgQuickBackend implements Backend {
|
||||
localTemporaryDir = new File(context.getCacheDir(), "tmp");
|
||||
}
|
||||
|
||||
@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) {
|
||||
@@ -94,6 +82,20 @@ public final class WgQuickBackend implements Backend {
|
||||
return new Statistics();
|
||||
}
|
||||
|
||||
@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);
|
||||
|
||||
Reference in New Issue
Block a user