diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-03-27 00:07:53 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-03-27 00:07:53 +0200 |
commit | 6053defd54e52fa61f4e6a0e24415cb6131f103c (patch) | |
tree | f5cebbf28c7cc4978450623980929912f3506b87 | |
parent | 0b574149e3361df62ae2a13bfff72d27b5d42078 (diff) |
tunnel: add backend to bgp constructorbuild5
-rw-r--r-- | tunnel/src/main/java/com/wireguard/android/backend/Bgp.java | 14 | ||||
-rw-r--r-- | tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java | 2 |
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); |