summaryrefslogtreecommitdiffhomepage
path: root/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2023-03-11 23:10:19 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2023-03-11 23:10:19 +0100
commit5394468b44f2ebcf3d5e8cae5cd70f770bb079ec (patch)
tree00c09a0c69ce8ea0f04cf759056df75bec96af0b /tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java
parent416a073c764764c487921235075e7e6cadfce0d5 (diff)
WIP: add bgp-java
Add bgp-java. Update peer list based on TunnelEncapsAttribute in BGP.
Diffstat (limited to 'tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java')
-rw-r--r--tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java b/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java
index 5a4dfc1e..860e2369 100644
--- a/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java
+++ b/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java
@@ -114,6 +114,7 @@ public final class GoBackend implements Backend {
private ConnectivityManager.NetworkCallback vpnNetworkCallback;
@Nullable private Network activeNetwork;
private boolean obtainDhcpLease = false;
+ @Nullable private Bgp bgp;
/**
* Public constructor for GoBackend.
@@ -435,6 +436,10 @@ public final class GoBackend implements Backend {
service.protect(wgGetSocketV4(currentTunnelHandle));
service.protect(wgGetSocketV6(currentTunnelHandle));
Log.i(TAG, "Dhcp done");
+
+ bgp = new Bgp(channel, currentTunnel, currentTunnelHandle);
+ bgp.startServer();
+
currentTunnel.onDhcpChange(dhcp);
}
@@ -714,6 +719,10 @@ public final class GoBackend implements Backend {
currentTunnel = null;
currentTunnelHandle = -1;
currentConfig = null;
+ if (bgp != null) {
+ bgp.stopServer();
+ bgp = null;
+ }
stopHttpProxy();
if (vpnNetworkCallback != null)
connectivityManager.unregisterNetworkCallback(vpnNetworkCallback);
@@ -782,6 +791,10 @@ public final class GoBackend implements Backend {
@Override
public void onDestroy() {
if (owner != null) {
+ if (owner.bgp != null) {
+ owner.bgp.stopServer();
+ owner.bgp = null;
+ }
owner.stopHttpProxy();
final Tunnel tunnel = owner.currentTunnel;
if (tunnel != null) {