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 ConnectionMetadataempty()Placeholder metadata for unsupported channel types.getHostAddress(@NonNull SocketAddress a) Get the host address string of the givenSocketAddressinstance.getHostName(@NonNull SocketAddress a) Get the host name of the givenSocketAddressinstance.@NonNull Optional<SocketAddress> The local address of this connection, if applicable.static @NonNull ConnectionMetadataofNettyChannel(@NonNull io.netty.channel.Channel channel) Create a newConnectionMetadatainstance for the given netty channel.@NonNull Optional<SocketAddress> The remote address of this connection, if applicable.
-
Method Details
-
localAddress
@NonNull Optional<SocketAddress> localAddress()The local address of this connection, if applicable.- Returns:
- The local address
-
remoteAddress
@NonNull Optional<SocketAddress> remoteAddress()The remote address of this connection, if applicable.- Returns:
- The remote address
-
getHostAddress
Get the host address string of the givenSocketAddressinstance. 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 givenSocketAddressinstance. 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
Create a newConnectionMetadatainstance 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
-