global: Automatic code formatting

Signed-off-by: Samuel Holland <samuel@sholland.org>
This commit is contained in:
Samuel Holland
2018-04-30 11:39:12 -05:00
parent e2636320b7
commit 7eedf08d4b
22 changed files with 964 additions and 990 deletions
@@ -27,48 +27,20 @@ import java9.util.concurrent.CompletableFuture;
public final class GoBackend implements Backend {
private static final String TAG = "WireGuard/" + GoBackend.class.getSimpleName();
private static CompletableFuture<VpnService> vpnService = new CompletableFuture<>();
static {
System.loadLibrary("wg-go");
}
private Context context;
private Tunnel currentTunnel;
private int currentTunnelHandle = -1;
private Context context;
public GoBackend(Context context) {
this.context = context;
}
private void startVpnService() {
context.startService(new Intent(context, VpnService.class));
}
public static class VpnService extends android.net.VpnService {
@Override
public void onCreate() {
vpnService.complete(this);
super.onCreate();
}
@Override
public void onDestroy() {
for (final Tunnel tunnel : Application.getComponent().getTunnelManager().getTunnels()) {
if (tunnel != null && tunnel.getState() != State.DOWN)
tunnel.setState(State.DOWN);
}
vpnService = vpnService.newIncompleteFuture();
super.onDestroy();
}
public Builder getBuilder() {
return new Builder();
}
}
private static CompletableFuture<VpnService> vpnService = new CompletableFuture<>();
private static native int wgGetSocketV4(int handle);
private static native int wgGetSocketV6(int handle);
@@ -219,4 +191,30 @@ public final class GoBackend implements Backend {
currentTunnelHandle = -1;
}
}
private void startVpnService() {
context.startService(new Intent(context, VpnService.class));
}
public static class VpnService extends android.net.VpnService {
public Builder getBuilder() {
return new Builder();
}
@Override
public void onCreate() {
vpnService.complete(this);
super.onCreate();
}
@Override
public void onDestroy() {
for (final Tunnel tunnel : Application.getComponent().getTunnelManager().getTunnels()) {
if (tunnel != null && tunnel.getState() != State.DOWN)
tunnel.setState(State.DOWN);
}
vpnService = vpnService.newIncompleteFuture();
super.onDestroy();
}
}
}