- All Known Subinterfaces:
ProxyProtocolV2Data
public interface ProxyProtocolData
Proxy protocol data parsed by
ProxyProtocolHandler. This interface exposes the fields which
are common across the text (V1) and binary (V2) variants of the Proxy protocol. If the binary protocol
was used, then the object which implements ProxyProtocolData will also implement ProxyProtocolV2Data.
This example shows how both shared (V1 and V2) and binary (V2-only) data can be accessed.
ProxyProtocolData data = ...;
// Extract common data.
Family protocolFamily = data.family();
// Extract additional binary data if applicable
if (data instanceof ProxyProtocolV2Data v2Data) {
Command command = v2Data.command();
}
]
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumProtocol family.static enumProtocol type. -
Method Summary
Modifier and TypeMethodDescriptionDestination address that is either IP4 or IP46 depending onfamily().intdestPort()Destination port number.family()Family from protocol header.protocol()Protocol from protocol header.Source address that is either IP4 or IP6 depending onfamily().intSource port number.
-
Method Details
-
family
ProxyProtocolData.Family family()Family from protocol header.- Returns:
- family
-
protocol
ProxyProtocolData.Protocol protocol()Protocol from protocol header.- Returns:
- protocol
-
sourceAddress
String sourceAddress()Source address that is either IP4 or IP6 depending onfamily().- Returns:
- source address or
""if not provided
-
destAddress
String destAddress()Destination address that is either IP4 or IP46 depending onfamily().- Returns:
- source address or (@code ""} if not provided
-
sourcePort
int sourcePort()Source port number.- Returns:
- source port.
-
destPort
int destPort()Destination port number.- Returns:
- port number.
-