summaryrefslogtreecommitdiffhomepage
path: root/tunnel
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2023-03-27 00:07:53 +0200
committerMikael Magnusson <mikma@users.sourceforge.net>2023-03-27 00:39:00 +0200
commitd0655f73157227e3227247998ad1bc5cbbc21339 (patch)
tree10f6f3857c7421e6c84548a26eed3bc461411bb1 /tunnel
parentfe12e5bb20cd3b9d6cb856ae210177cd2a01b8fc (diff)
tunnel: add backend to bgp constructorold/dhcp2
Diffstat (limited to 'tunnel')
-rw-r--r--tunnel/src/main/java/com/wireguard/android/backend/Bgp.java14
-rw-r--r--tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java2
2 files changed, 10 insertions, 6 deletions
diff --git a/tunnel/src/main/java/com/wireguard/android/backend/Bgp.java b/tunnel/src/main/java/com/wireguard/android/backend/Bgp.java
index 12668621..a6a8b420 100644
--- a/tunnel/src/main/java/com/wireguard/android/backend/Bgp.java
+++ b/tunnel/src/main/java/com/wireguard/android/backend/Bgp.java
@@ -23,6 +23,7 @@ import com.lumaserv.bgp.protocol.attribute.PathAttribute;
import com.lumaserv.bgp.protocol.attribute.TunnelEncapsAttribute;
import com.lumaserv.bgp.protocol.message.BGPUpdate;
+import com.wireguard.android.backend.Backend;
import com.wireguard.config.InetEndpoint;
import com.wireguard.config.InetNetwork;
import com.wireguard.crypto.Key;
@@ -53,12 +54,14 @@ public class Bgp implements BGPListener {
private static final int PORT = 0;
private static final int STATS_TAG = 1; // FIXME
- private ManagedChannel channel;
- private Tunnel tunnel;
- private int tunnelHandle;
+ private final Backend backend;
+ private final ManagedChannel channel;
+ private final Tunnel tunnel;
+ private final int tunnelHandle;
private BGPServer server;
- public Bgp(ManagedChannel channel, Tunnel tunnel, int tunnelHandle) {
+ public Bgp(Backend backend, ManagedChannel channel, Tunnel tunnel, int tunnelHandle) {
+ this.backend = backend;
this.channel = channel;
this.tunnel = tunnel;
this.tunnelHandle = tunnelHandle;
@@ -196,7 +199,8 @@ public class Bgp implements BGPListener {
}
tunnel.onAllowedIpsChange(publicKey, addNetworks, removeNetworks);
-
+ // backend.addAllowedIps(tunnel, publicKey, addNetworks);
+ // backend.removeAllowedIps(tunnel, publicKey, addNetworks); // TODO
} catch (KeyFormatException ex) {
Log.w(TAG, "Key.fromBytes " + ex);
}
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 894059c7..9c96e00f 100644
--- a/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java
+++ b/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java
@@ -460,7 +460,7 @@ public final class GoBackend implements Backend {
service.protect(wgGetSocketV6(currentTunnelHandle));
Log.i(TAG, "Dhcp done");
- bgp = new Bgp(channel, currentTunnel, currentTunnelHandle);
+ bgp = new Bgp(this, channel, currentTunnel, currentTunnelHandle);
bgp.startServer();
currentTunnel.onDhcpChange(dhcp);