InetAddress for an AFSocketAddress.
DatagramPacket internally requires InetAddress compatibility. Even if it pretends to
accept SocketAddresses, it refuses anything other than InetSocketAddress
and then even stores host and port separately.
This implementation deserializes a specially crafted InetAddress with a hostname that
encodes the raw bytes of an AFSocketAddress. We do this because the deserialization code
path does not attempt DNS resolution (which would fail one way or another).
The hostnames we use end with ".junixsocket", to distinguish them from regular hostnames.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final String | |
| private static final byte[] | |
| private static final String | |
| private static final char |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static final String | Returns: A string, to be used when callingInetSocketAddress#InetSocketAddress(String, int), etc.The socket address. socketAddress, AFAddressFamily<?> af)Encodes a junixsocket socketAddress into a string that is (somewhat) guaranteed to not be resolved by java.net code. |
| pack-priv static boolean | |
| pack-priv static final byte[] | |
| pack-priv static final byte[] | |
| pack-priv static final InetAddress | Returns: TheInetAddress.The socket address. socketAddress, AFAddressFamily<?> af)Creates an InetAddress that is considered "resolved" internally (using a static loopback
address), without actually having to resolve the address via DNS, thus still carrying the
"hostname" field containing a hostname as returned by
|
| INETADDR_SUFFIX | back to summary |
|---|---|
| pack-priv static final String INETADDR_SUFFIX | |
| LOCAL_AF | back to summary |
|---|---|
| private static final byte[] LOCAL_AF | |
| MARKER_HEX_ENCODING | back to summary |
|---|---|
| private static final String MARKER_HEX_ENCODING | |
| PREFIX | back to summary |
|---|---|
| private static final char PREFIX | |
| AFInetAddress | back to summary |
|---|---|
| pack-priv AFInetAddress() | |
| createUnresolvedHostname | back to summary |
|---|---|
| pack-priv static final String createUnresolvedHostname(byte[] socketAddress, AFAddressFamily<?> af) Encodes a junixsocket socketAddress into a string that is (somewhat) guaranteed to not be
resolved by java.net code.
Implementation detail: The "[" prefix (with the corresponding "]" suffix missing from the
input) should cause an early
| |
| isSupportedAddress | back to summary |
|---|---|
| pack-priv static boolean isSupportedAddress(InetAddress addr, AFAddressFamily<?> af) | |
| unwrapAddress | back to summary |
|---|---|
| pack-priv static final byte[] unwrapAddress(InetAddress addr, AFAddressFamily<?> af) throws SocketException | |
| unwrapAddress | back to summary |
|---|---|
| pack-priv static final byte[] unwrapAddress(String hostname, AFAddressFamily<?> af) throws SocketException | |
| wrapAddress | back to summary |
|---|---|
| pack-priv static final InetAddress wrapAddress(byte[] socketAddress, AFAddressFamily<?> af) Creates an InetAddress that is considered "resolved" internally (using a static loopback
address), without actually having to resolve the address via DNS, thus still carrying the
"hostname" field containing a hostname as returned by
| |