java.lang.Object
convex.net.IPUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic InetSocketAddressparseAddress(String hostname, Integer port) Parses a socket addressstatic InetSocketAddressConverts a Object to an InetSocketAddressstatic InetSocketAddressConverts a String to an InetSocketAddressstatic InetSocketAddresstoInetSocketAddress(URI uri) Converts a URI to an InetSocketAddress.static InetSocketAddresstoInetSocketAddress(URL url) Converts a URL to an InetSocketAddress.static InetAddresstryGetIP()static String
-
Constructor Details
-
IPUtils
public IPUtils()
-
-
Method Details
-
tryGetIP
- Throws:
InterruptedException
-
tryGetWTF
- Throws:
InterruptedException
-
toInetSocketAddress
Converts a Object to an InetSocketAddress- Parameters:
o- An Object to convert to a socket address. May be a String or existing InetSocketAddress- Returns:
- A valid InetSocketAddress, or null if not in valid format
-
toInetSocketAddress
Converts a String to an InetSocketAddress- Parameters:
s- A string in the format of a valid URL or "myhost.com:17888"- Returns:
- A valid InetSocketAddress, or null if not in valid format
-
toInetSocketAddress
Converts a URL to an InetSocketAddress. Will assume default port if not specified.- Parameters:
url- A valid URL- Returns:
- A valid InetSocketAddress for the URL
-
toInetSocketAddress
Converts a URI to an InetSocketAddress. Will assume default port if not specified.- Parameters:
uri- A valid URI- Returns:
- A valid InetSocketAddress for the URI
-
main
- Throws:
InterruptedException
-
parseAddress
Parses a socket address- Parameters:
hostname- Hostname or "host:port" stringport- Port to use (null implies default peer port, or whatever specified in hostname)- Returns:
- Socket address or null if failed to parse
-