summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2023-10-28 23:14:37 +0200
committerMikael Magnusson <mikma@users.sourceforge.net>2023-10-28 23:15:30 +0200
commitcee6609a98165461413e1ae3faac8671673adf4b (patch)
tree35184c31f8fa1ea3f20953f2cb7e981887da4b6b
parent8ea8a6ed9d00f8d1da576a7b0715d257534de0fc (diff)
WIP: add default persistent keepalive to bgp code
-rw-r--r--tunnel/src/main/java/com/wireguard/android/backend/Backend.java1
-rw-r--r--tunnel/src/main/java/com/wireguard/android/backend/Bgp.java2
-rw-r--r--tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java3
-rw-r--r--tunnel/src/main/java/com/wireguard/android/backend/WgQuickBackend.java1
-rw-r--r--ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt2
5 files changed, 6 insertions, 3 deletions
diff --git a/tunnel/src/main/java/com/wireguard/android/backend/Backend.java b/tunnel/src/main/java/com/wireguard/android/backend/Backend.java
index fc281072..7e40da3f 100644
--- a/tunnel/src/main/java/com/wireguard/android/backend/Backend.java
+++ b/tunnel/src/main/java/com/wireguard/android/backend/Backend.java
@@ -72,5 +72,6 @@ public interface Backend {
void addAllowedIps(Tunnel tunnel, Key publicKey, List<InetNetwork> addNetworks);
void setPeer(Tunnel tunnel, Key publicKey, @Nullable InetEndpoint endpoint,
+ Integer persistentKeepalive,
List<InetNetwork> addAllowedIps, List<InetNetwork> removeAllowedIps);
}
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 ddf01199..f648f240 100644
--- a/tunnel/src/main/java/com/wireguard/android/backend/Bgp.java
+++ b/tunnel/src/main/java/com/wireguard/android/backend/Bgp.java
@@ -201,7 +201,7 @@ public class Bgp implements BGPListener {
tunnel.onAllowedIpsChange(publicKey, addNetworks, removeNetworks);
// backend.addAllowedIps(tunnel, publicKey, addNetworks);
// backend.removeAllowedIps(tunnel, publicKey, addNetworks); // TODO
- backend.setPeer(tunnel, publicKey, endpoint, addNetworks, removeNetworks);
+ backend.setPeer(tunnel, publicKey, endpoint, 24550, addNetworks, removeNetworks);
} 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 635c04f0..0e9668d0 100644
--- a/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java
+++ b/tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java
@@ -342,6 +342,7 @@ public final class GoBackend implements Backend {
@Override
public void setPeer(Tunnel tunnel, Key publicKey, @Nullable InetEndpoint endpoint,
+ Integer persistentKeepalive,
List<InetNetwork> addAllowedIps, List<InetNetwork> removeAllowedIps) {
if (tunnel != currentTunnel) {
// TODO logerror and/or return error/throw.
@@ -362,7 +363,7 @@ public final class GoBackend implements Backend {
endpoint.getResolved(resolver, true).ifPresent(ep -> sb.append("endpoint=").append(ep).append('\n'));
}
- sb.append("persistent_keepalive_interval=").append(24550).append('\n');
+ sb.append("persistent_keepalive_interval=").append(persistentKeepalive).append('\n');
String goConfig = sb.toString();
// TODO removed removeNetworks
diff --git a/tunnel/src/main/java/com/wireguard/android/backend/WgQuickBackend.java b/tunnel/src/main/java/com/wireguard/android/backend/WgQuickBackend.java
index 3cc1c822..645b2fe0 100644
--- a/tunnel/src/main/java/com/wireguard/android/backend/WgQuickBackend.java
+++ b/tunnel/src/main/java/com/wireguard/android/backend/WgQuickBackend.java
@@ -176,6 +176,7 @@ public final class WgQuickBackend implements Backend {
@Override
public void setPeer(Tunnel tunnel, Key publicKey, @Nullable InetEndpoint endpoint,
+ Integer persistentKeepalive,
List<InetNetwork> addAllowedIps, List<InetNetwork> removeAllowedIps) {
throw new RuntimeException("Not implemented");
}
diff --git a/ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt b/ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt
index 3171a7b7..e4916b55 100644
--- a/ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt
+++ b/ui/src/main/java/com/wireguard/android/model/ObservableTunnel.kt
@@ -237,7 +237,7 @@ class ObservableTunnel internal constructor(
private fun onPersistentKeepaliveChanged(publicKey: Key, newPersistentKeepalive: Integer?) {
var peer: PeerDetail = lookupPeer(publicKey)
- peer.
+ peer.persistentKeepalive = newPersistentKeepalive
}
override fun onAllowedIpsChange(publicKey: Key, addNetworks: List<InetNetwork>?, removeNetworks: List<InetNetwork>?) {