java.lang.Object
convex.net.IPUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
static InetSocketAddress
parseAddress
(String hostname, Integer port) Parses a socket addressstatic InetSocketAddress
Converts a Object to an InetSocketAddressstatic InetSocketAddress
Converts a String to an InetSocketAddressstatic InetSocketAddress
toInetSocketAddress
(URI uri) Converts a URI to an InetSocketAddress.static InetSocketAddress
toInetSocketAddress
(URL url) Converts a URL to an InetSocketAddress.static InetAddress
tryGetIP()
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
-