| Modifier and Type | Class and Description |
|---|---|
| private abstract class | HAProxyMessageDecoder.HeaderExtractor
HeaderExtractor create a header frame out of the |
| private class | |
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private static final int | BINARY_PREFIX_LENGTH
Binary header prefix length |
| private static final ProtocolDetectionResult | |
| private static final ProtocolDetectionResult | |
| private int | discardedBytes
Number of discarded bytes |
| private boolean | discarding
|
| private final boolean | failFast
Whether or not to throw an exception as soon as we exceed maxLength. |
| private boolean | finished
|
| private HAProxyMessageDecoder. | headerExtractor
Used to extract a header frame out of the |
| private static final int | V1_MAX_LENGTH
Maximum possible length of a v1 proxy protocol header per spec |
| private static final int | V2_MAX_LENGTH
Maximum possible length of a v2 proxy protocol header (fixed 16 bytes + max unsigned short) |
| private static final int | V2_MAX_TLV
Maximum possible length for v2 additional TLV data (max unsigned short - max v2 address info space) |
| private static final int | V2_MIN_LENGTH
Minimum possible length of a fully functioning v2 proxy protocol header (fixed 16 bytes + v2 address info space) |
| private final int | v2MaxHeaderSize
The latest v2 spec (2014/05/18) allows for additional data to be sent in the proxy protocol header beyond the address information block so now we need a configurable max header size |
| private int | version
Protocol specification version |
| Access | Constructor and Description |
|---|---|
| public | HAProxyMessageDecoder()
Creates a new decoder with no additional data (TLV) restrictions, and should throw an exception as soon as we exceed maxLength. |
| public | HAProxyMessageDecoder(boolean
Whether or not to throw an exception as soon as we exceed maxLength failFast)Creates a new decoder with no additional data (TLV) restrictions, whether or not to throw an exception as soon as we exceed maxLength. |
| public | HAProxyMessageDecoder(int
maximum number of bytes allowed for additional data (Type-Length-Value vectors) in a v2 header maxTlvSize)Creates a new decoder with restricted additional data (TLV) size, and should throw an exception as soon as we exceed maxLength. |
| public | HAProxyMessageDecoder(int
maximum number of bytes allowed for additional data (Type-Length-Value vectors) in a v2 header maxTlvSize, boolean Whether or not to throw an exception as soon as we exceed maxLength failFast)Creates a new decoder with restricted additional data (TLV) size, whether or not to throw an exception as soon as we exceed maxLength. |
| Modifier and Type | Method and Description |
|---|---|
| public void | channelExceptionCaught(ChannelHandlerContext ctx, Throwable cause)
Overrides default io. Throwable was thrown when handling inbound events.
|
| public void | channelRead(ChannelHandlerContext ctx, Object msg)
Overrides io. Overrides default io. Channel has read a message from the peer.
|
| protected final void | decode(ChannelHandlerContext
the ctx, Buffer ChannelHandlerContext which this ByteToMessageDecoder belongs tothe in)Buffer from which to read dataImplements abstract io. Buffer to another.
|
| private Buffer | decodeLine(ChannelHandlerContext
the ctx, Buffer ChannelHandlerContext which this HAProxyMessageDecoder belongs tothe buffer)Buffer from which to read dataCreate a frame out of the |
| private Buffer | decodeStruct(ChannelHandlerContext
the ctx, Buffer ChannelHandlerContext which this HAProxyMessageDecoder belongs tothe buffer)Buffer from which to read dataCreate a frame out of the |
| public static ProtocolDetectionResult | |
| private void | |
| private void | |
| private void | |
| private static int | |
| private static int | |
| private static int | findVersion(final Buffer buffer)
Returns the proxy protocol specification version in the buffer if the version is found. |
| public boolean | isSingleDecode()
Overrides io. true then only one message is decoded on each
channelRead(ChannelHandlerContext, Object) call.
|
| private static boolean |
| BINARY_PREFIX_LENGTH | back to summary |
|---|---|
| private static final int BINARY_PREFIX_LENGTH Binary header prefix length | |
| DETECTION_RESULT_V1 | back to summary |
|---|---|
| private static final ProtocolDetectionResult<HAProxyProtocolVersion> DETECTION_RESULT_V1 | |
| DETECTION_RESULT_V2 | back to summary |
|---|---|
| private static final ProtocolDetectionResult<HAProxyProtocolVersion> DETECTION_RESULT_V2 | |
| discardedBytes | back to summary |
|---|---|
| private int discardedBytes Number of discarded bytes | |
| discarding | back to summary |
|---|---|
| private boolean discarding
| |
| failFast | back to summary |
|---|---|
| private final boolean failFast Whether or not to throw an exception as soon as we exceed maxLength. | |
| finished | back to summary |
|---|---|
| private boolean finished
| |
| headerExtractor | back to summary |
|---|---|
| private HAProxyMessageDecoder. Used to extract a header frame out of the | |
| V1_MAX_LENGTH | back to summary |
|---|---|
| private static final int V1_MAX_LENGTH Maximum possible length of a v1 proxy protocol header per spec | |
| V2_MAX_LENGTH | back to summary |
|---|---|
| private static final int V2_MAX_LENGTH Maximum possible length of a v2 proxy protocol header (fixed 16 bytes + max unsigned short) | |
| V2_MAX_TLV | back to summary |
|---|---|
| private static final int V2_MAX_TLV Maximum possible length for v2 additional TLV data (max unsigned short - max v2 address info space) | |
| V2_MIN_LENGTH | back to summary |
|---|---|
| private static final int V2_MIN_LENGTH Minimum possible length of a fully functioning v2 proxy protocol header (fixed 16 bytes + v2 address info space) | |
| v2MaxHeaderSize | back to summary |
|---|---|
| private final int v2MaxHeaderSize The latest v2 spec (2014/05/18) allows for additional data to be sent in the proxy protocol header beyond the address information block so now we need a configurable max header size | |
| version | back to summary |
|---|---|
| private int version Protocol specification version | |
| HAProxyMessageDecoder | back to summary |
|---|---|
| public HAProxyMessageDecoder() Creates a new decoder with no additional data (TLV) restrictions, and should throw an exception as soon as we exceed maxLength. | |
| HAProxyMessageDecoder | back to summary |
|---|---|
| public HAProxyMessageDecoder(boolean failFast) Creates a new decoder with no additional data (TLV) restrictions, whether or not to throw an exception as soon as we exceed maxLength.
| |
| HAProxyMessageDecoder | back to summary |
|---|---|
| public HAProxyMessageDecoder(int maxTlvSize) Creates a new decoder with restricted additional data (TLV) size, and should throw an exception as soon as we exceed maxLength. Note limiting TLV size only affects processing of v2, binary headers. Also, as allowed by the 1.5 spec
TLV data is currently ignored. For maximum performance it would be best to configure your upstream proxy host to
NOT send TLV data and instantiate with a max TLV size of
| |
| HAProxyMessageDecoder | back to summary |
|---|---|
| public HAProxyMessageDecoder(int maxTlvSize, boolean failFast) Creates a new decoder with restricted additional data (TLV) size, whether or not to throw an exception as soon as we exceed maxLength.
| |
| channelExceptionCaught | back to summary |
|---|---|
| public void channelExceptionCaught(ChannelHandlerContext ctx, Throwable cause) Overrides default io. Doc from io. Gets called if a
| |
| channelRead | back to summary |
|---|---|
| public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception Overrides io. Overrides default io. Doc from io. Invoked when the current
| |
| decode | back to summary |
|---|---|
| protected final void decode(ChannelHandlerContext ctx, Buffer in) Implements abstract io. Doc from io. Decode the from one
| |
| decodeLine | back to summary |
|---|---|
| private Buffer decodeLine(ChannelHandlerContext ctx, Buffer buffer) Create a frame out of the
| |
| decodeStruct | back to summary |
|---|---|
| private Buffer decodeStruct(ChannelHandlerContext ctx, Buffer buffer) Create a frame out of the
| |
| detectProtocol | back to summary |
|---|---|
| public static ProtocolDetectionResult Returns the | |
| fail | back to summary |
|---|---|
| private void fail(final ChannelHandlerContext ctx, String errMsg, Exception e) | |
| failOverLimit | back to summary |
|---|---|
| private void failOverLimit(final ChannelHandlerContext ctx, int length) | |
| failOverLimit | back to summary |
|---|---|
| private void failOverLimit(final ChannelHandlerContext ctx, String length) | |
| findEndOfHeader | back to summary |
|---|---|
| private static int findEndOfHeader(final Buffer buffer) Returns the index in the buffer of the end of header if found. Returns -1 if no end of header was found in the buffer. | |
| findEndOfLine | back to summary |
|---|---|
| private static int findEndOfLine(final Buffer buffer) Returns the index in the buffer of the end of line found. Returns -1 if no end of line was found in the buffer. | |
| findVersion | back to summary |
|---|---|
| private static int findVersion(final Buffer buffer) Returns the proxy protocol specification version in the buffer if the version is found. Returns -1 if no version was found in the buffer. | |
| isSingleDecode | back to summary |
|---|---|
| public boolean isSingleDecode() Overrides io. Doc from io. If
| |
| match | back to summary |
|---|---|
| private static boolean match(byte[] prefix, Buffer buffer, int idx) | |
Buffer.
| Modifier and Type | Field and Description |
|---|---|
| private final int | maxHeaderSize
Header max size |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected abstract int | Returns: length of the delimiterthe buffer where delimiter is located buffer, int index of delimiter eoh)Get the length of the header delimiter. |
| public Buffer | extract(ChannelHandlerContext
the ctx, Buffer ChannelHandlerContext which this HAProxyMessageDecoder belongs tothe buffer)Buffer from which to read dataCreate a frame out of the |
| protected abstract int | Returns: -1 if can not find the end, otherwise return the buffer index of endthe buffer to be searched buffer)Find the end of the header from the given |
| maxHeaderSize | back to summary |
|---|---|
| private final int maxHeaderSize Header max size | |
| HeaderExtractor | back to summary |
|---|---|
| protected HeaderExtractor(int maxHeaderSize) | |
| delimiterLength | back to summary |
|---|---|
| protected abstract int delimiterLength(Buffer buffer, int eoh) Get the length of the header delimiter.
| |
| extract | back to summary |
|---|---|
| public Buffer extract(ChannelHandlerContext ctx, Buffer buffer) Create a frame out of the
| |
| findEndOfHeader | back to summary |
|---|---|
| protected abstract int findEndOfHeader(Buffer buffer) Find the end of the header from the given
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| protected int | delimiterLength(Buffer
the buffer where delimiter is located buffer, int index of delimiter eoh)Implements abstract io. |
| protected int | findEndOfHeader(Buffer
the buffer to be searched buffer)Implements abstract io. Buffer,the end may be a CRLF, or the length given by the
header.
|
| LineHeaderExtractor | back to summary |
|---|---|
| pack-priv LineHeaderExtractor(int maxHeaderSize) | |
| delimiterLength | back to summary |
|---|---|
| protected int delimiterLength(Buffer buffer, int eoh) Implements abstract io. Doc from io. Get the length of the header delimiter. | |
| findEndOfHeader | back to summary |
|---|---|
| protected int findEndOfHeader(Buffer buffer) Implements abstract io. Doc from io. Find the end of the header from the given | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| protected int | delimiterLength(Buffer
the buffer where delimiter is located buffer, int index of delimiter eoh)Implements abstract io. |
| protected int | findEndOfHeader(Buffer
the buffer to be searched buffer)Implements abstract io. Buffer,the end may be a CRLF, or the length given by the
header.
|
| StructHeaderExtractor | back to summary |
|---|---|
| pack-priv StructHeaderExtractor(int maxHeaderSize) | |
| delimiterLength | back to summary |
|---|---|
| protected int delimiterLength(Buffer buffer, int eoh) Implements abstract io. Doc from io. Get the length of the header delimiter. | |
| findEndOfHeader | back to summary |
|---|---|
| protected int findEndOfHeader(Buffer buffer) Implements abstract io. Doc from io. Find the end of the header from the given | |