Package com.linecorp.armeria.common.util
Class DomainSocketAddress
java.lang.Object
java.net.SocketAddress
java.net.InetSocketAddress
com.linecorp.armeria.common.util.DomainSocketAddress
- All Implemented Interfaces:
Serializable
An
InetSocketAddress
that refers to the Path
of a Unix domain socket.
This class extends InetSocketAddress
to ensure the backward compatibility with existing
Armeria API that uses InetSocketAddress
in its API. This address will have the following properties:
- hostname and hostString -
"unix:<path>"
, e.g."unix:/var/run/server.sock"
- address - an IPv6 address that falls into IPv6 Discard Prefix
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionConverts this address to anEndpoint
.Converts this address to a NettyDomainSocketAddress
.Returns the authority (host) form of this address which can be used as a part ofURI
.static boolean
Returns whether the specifiedInetAddress
matches the special IPv6 address ofDomainSocketAddress
.static DomainSocketAddress
of
(DomainSocketAddress nettyAddr) Returns a newly createdDomainSocketAddress
with thePath
to the Unix domain socket that the specified Netty address refers to.static DomainSocketAddress
Returns a newly createdDomainSocketAddress
with the specifiedPath
to the Unix domain socket.path()
Returns thePath
to the Unix domain socket.toString()
Returns a string representation of this address, such as"/path/to/sock"
.Methods inherited from class java.net.InetSocketAddress
createUnresolved, equals, getAddress, getHostName, getHostString, getPort, hashCode, isUnresolved
-
Method Details
-
of
Returns a newly createdDomainSocketAddress
with the specifiedPath
to the Unix domain socket. -
of
Returns a newly createdDomainSocketAddress
with thePath
to the Unix domain socket that the specified Netty address refers to. -
isDomainSocketAddress
Returns whether the specifiedInetAddress
matches the special IPv6 address ofDomainSocketAddress
. For example:DomainSocketAddress sockAddr = DomainSocketAddress.of("/var/run/server.sock"); InetAddress inetAddr = sockAddr.getAddress(); assert isDomainSocketAddress(inetAddr);
-
path
Returns thePath
to the Unix domain socket. -
authority
Returns the authority (host) form of this address which can be used as a part ofURI
. -
asNettyAddress
Converts this address to a NettyDomainSocketAddress
.- Returns:
- the converted Netty address
-
asEndpoint
Converts this address to anEndpoint
. -
toString
Returns a string representation of this address, such as"/path/to/sock"
.- Overrides:
toString
in classInetSocketAddress
-