From ad0dd18dd581d95bd13ce3110d156583227e7e57 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Sat, 11 Mar 2023 23:10:19 +0100 Subject: tunnel: add bgp-java Add bgp-java. Update peer list based on TunnelEncapsAttribute in BGP. Add backend to bgp constructor --- tunnel/src/main/java/com/wireguard/config/InetEndpoint.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tunnel/src/main/java/com/wireguard/config') diff --git a/tunnel/src/main/java/com/wireguard/config/InetEndpoint.java b/tunnel/src/main/java/com/wireguard/config/InetEndpoint.java index 86f5f9a8..dffd534b 100644 --- a/tunnel/src/main/java/com/wireguard/config/InetEndpoint.java +++ b/tunnel/src/main/java/com/wireguard/config/InetEndpoint.java @@ -65,6 +65,10 @@ public final class InetEndpoint { } } + public static InetEndpoint fromAddress(final InetAddress address, final int port) { + return new InetEndpoint(address.getHostAddress(), true, port); + } + @Override public boolean equals(final Object obj) { if (!(obj instanceof InetEndpoint)) @@ -82,7 +86,11 @@ public final class InetEndpoint { } public Optional getResolved() { - return Optional.ofNullable(resolved); + if (isResolved) { + return Optional.of(this); + } else { + return Optional.ofNullable(resolved); + } } /** -- cgit v1.2.3