diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-03-11 23:10:19 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-04-28 23:16:33 +0200 |
commit | 0104d4447e0ae55ee0c77d51dbda81594eecef79 (patch) | |
tree | 54a954385891b7392b83966b70a142d515b65f53 /tunnel/src/main/java/com/wireguard/config | |
parent | c284fa0232fbc8d1bbf68497294723d45cb074b1 (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); + } } /** |