Interface ProxyProtocolData

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();
 }
 ]
 
  • Method Details

    • family

      Family from protocol header.
      Returns:
      family
    • protocol

      Protocol from protocol header.
      Returns:
      protocol
    • sourceAddress

      String sourceAddress()
      Source address that is either IP4 or IP6 depending on family().
      Returns:
      source address or "" if not provided
    • destAddress

      String destAddress()
      Destination address that is either IP4 or IP46 depending on family().
      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.