Interface ConnectionMetadata
public interface ConnectionMetadata
Connection-level metadata for logging e.g. addresses or ports.
- Since:
- 4.6.0
- Author:
- Jonas Konrad
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull ConnectionMetadata
empty()
Placeholder metadata for unsupported channel types.Get the host address string of the givenSocketAddress
instance.Get the host name of the givenSocketAddress
instance.The local address of this connection, if applicable.static @NonNull ConnectionMetadata
ofNettyChannel
(@NonNull io.netty.channel.Channel channel) Create a newConnectionMetadata
instance for the given netty channel.The remote address of this connection, if applicable.
-
Method Details
-
localAddress
The local address of this connection, if applicable.- Returns:
- The local address
-
remoteAddress
The remote address of this connection, if applicable.- Returns:
- The remote address
-
getHostAddress
Get the host address string of the givenSocketAddress
instance. This is usually the numeric IP, but for unix domain socket it is the file path.- Parameters:
a
- The address- Returns:
- The string representation, or
Optional.empty()
if this type of address is not supported
-
getHostName
Get the host name of the givenSocketAddress
instance. This is usually the DNS name or IP, but for unix domain socket it is the file path.- Parameters:
a
- The address- Returns:
- The string representation, or
Optional.empty()
if this type of address is not supported
-
ofNettyChannel
@NonNull static @NonNull ConnectionMetadata ofNettyChannel(@NonNull @NonNull io.netty.channel.Channel channel) Create a newConnectionMetadata
instance for the given netty channel.- Parameters:
channel
- The channel- Returns:
- The metadata, potentially
empty()
-
empty
Placeholder metadata for unsupported channel types.- Returns:
- An empty metadata instance
-