Package com.wireguard.config
Class InetEndpoint
- java.lang.Object
-
- com.wireguard.config.InetEndpoint
-
public final class InetEndpoint extends java.lang.Object
An external endpoint (host and port) used to connect to a WireGuardPeer
.Instances of this class are externally immutable.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
java.lang.String
getHost()
int
getPort()
java.util.Optional<InetEndpoint>
getResolved()
Generate anInetEndpoint
instance with the same port and the host resolved using DNS to a numeric address.int
hashCode()
static InetEndpoint
parse(java.lang.String endpoint)
java.lang.String
toString()
-
-
-
Method Detail
-
parse
public static InetEndpoint parse(java.lang.String endpoint) throws ParseException
- Throws:
ParseException
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
getHost
public java.lang.String getHost()
-
getPort
public int getPort()
-
getResolved
public java.util.Optional<InetEndpoint> getResolved()
Generate anInetEndpoint
instance with the same port and the host resolved using DNS to a numeric address. If the host is already numeric, the existing instance may be returned. Because this function may perform network I/O, it must not be called from the main thread.- Returns:
- the resolved endpoint, or
Optional.empty()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-