diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-03-11 23:10:19 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-05-10 21:08:27 +0200 |
commit | ad0dd18dd581d95bd13ce3110d156583227e7e57 (patch) | |
tree | 0c454400f7c568fa637deb3977f5b96cb4173c6b /tunnel/src/main/java/com/wireguard/config | |
parent | 70ad859a1401131c6fd981bd12a8c6d0fb9f51da (diff) |
tunnel: add bgp-java
Add bgp-java.
Update peer list based on TunnelEncapsAttribute in BGP.
Add backend to bgp constructor
Diffstat (limited to 'tunnel/src/main/java/com/wireguard/config')
-rw-r--r-- | tunnel/src/main/java/com/wireguard/config/InetEndpoint.java | 10 |
1 files changed, 9 insertions, 1 deletions
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<InetEndpoint> getResolved() { - return Optional.ofNullable(resolved); + if (isResolved) { + return Optional.of(this); + } else { + return Optional.ofNullable(resolved); + } } /** |