HAProxyMessageDecoder Class — netty Architecture
Architecture documentation for the HAProxyMessageDecoder class in HAProxyMessageDecoder.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 779adff2_46a7_a104_ccd9_84680387d552["HAProxyMessageDecoder"] 891c9404_8383_1a70_6e1e_6faaf7176a96["HAProxyMessageDecoder.java"] 779adff2_46a7_a104_ccd9_84680387d552 -->|defined in| 891c9404_8383_1a70_6e1e_6faaf7176a96 d0fad390_7d46_8892_9c34_b47089031f94["HAProxyMessageDecoder()"] 779adff2_46a7_a104_ccd9_84680387d552 -->|method| d0fad390_7d46_8892_9c34_b47089031f94 a6d80843_53e8_c46e_df6c_c1c99ea1a37a["findVersion()"] 779adff2_46a7_a104_ccd9_84680387d552 -->|method| a6d80843_53e8_c46e_df6c_c1c99ea1a37a 9878c685_16b8_942e_9fe6_72c7889bb89b["findEndOfHeader()"] 779adff2_46a7_a104_ccd9_84680387d552 -->|method| 9878c685_16b8_942e_9fe6_72c7889bb89b 303a137a_8b64_dcda_46bb_a9016df1352e["findEndOfLine()"] 779adff2_46a7_a104_ccd9_84680387d552 -->|method| 303a137a_8b64_dcda_46bb_a9016df1352e 26473116_a831_529b_7e97_77ed3bde00bc["isSingleDecode()"] 779adff2_46a7_a104_ccd9_84680387d552 -->|method| 26473116_a831_529b_7e97_77ed3bde00bc dd41cabc_8e98_d865_4132_22ef7a6ccffd["channelRead()"] 779adff2_46a7_a104_ccd9_84680387d552 -->|method| dd41cabc_8e98_d865_4132_22ef7a6ccffd 5c5e7bc9_025c_6ef6_d933_6646e8180072["decode()"] 779adff2_46a7_a104_ccd9_84680387d552 -->|method| 5c5e7bc9_025c_6ef6_d933_6646e8180072 ea966942_f180_92ed_037e_5081ac54bb5c["ByteBuf()"] 779adff2_46a7_a104_ccd9_84680387d552 -->|method| ea966942_f180_92ed_037e_5081ac54bb5c 23921ca9_0bcc_4691_cc52_b64c6b92259c["failOverLimit()"] 779adff2_46a7_a104_ccd9_84680387d552 -->|method| 23921ca9_0bcc_4691_cc52_b64c6b92259c 4bcf7a2e_b41c_ffbf_c326_61a787af2c17["fail()"] 779adff2_46a7_a104_ccd9_84680387d552 -->|method| 4bcf7a2e_b41c_ffbf_c326_61a787af2c17 2aff155a_12eb_fa75_8a95_74911d7789e8["detectProtocol()"] 779adff2_46a7_a104_ccd9_84680387d552 -->|method| 2aff155a_12eb_fa75_8a95_74911d7789e8 5118ce8f_1171_e837_05e2_e7fad6a7ed1b["match()"] 779adff2_46a7_a104_ccd9_84680387d552 -->|method| 5118ce8f_1171_e837_05e2_e7fad6a7ed1b
Relationship Graph
Source Code
codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessageDecoder.java lines 33–463
public class HAProxyMessageDecoder extends ByteToMessageDecoder {
/**
* Maximum possible length of a v1 proxy protocol header per spec
*/
private static final int V1_MAX_LENGTH = 108;
/**
* Maximum possible length of a v2 proxy protocol header (fixed 16 bytes + max unsigned short)
*/
private static final int V2_MAX_LENGTH = 16 + 65535;
/**
* Minimum possible length of a fully functioning v2 proxy protocol header (fixed 16 bytes + v2 address info space)
*/
private static final int V2_MIN_LENGTH = 16 + 216;
/**
* Maximum possible length for v2 additional TLV data (max unsigned short - max v2 address info space)
*/
private static final int V2_MAX_TLV = 65535 - 216;
/**
* Binary header prefix length
*/
private static final int BINARY_PREFIX_LENGTH = BINARY_PREFIX.length;
/**
* {@link ProtocolDetectionResult} for {@link HAProxyProtocolVersion#V1}.
*/
private static final ProtocolDetectionResult<HAProxyProtocolVersion> DETECTION_RESULT_V1 =
ProtocolDetectionResult.detected(HAProxyProtocolVersion.V1);
/**
* {@link ProtocolDetectionResult} for {@link HAProxyProtocolVersion#V2}.
*/
private static final ProtocolDetectionResult<HAProxyProtocolVersion> DETECTION_RESULT_V2 =
ProtocolDetectionResult.detected(HAProxyProtocolVersion.V2);
/**
* Used to extract a header frame out of the {@link ByteBuf} and return it.
*/
private HeaderExtractor headerExtractor;
/**
* {@code true} if we're discarding input because we're already over maxLength
*/
private boolean discarding;
/**
* Number of discarded bytes
*/
private int discardedBytes;
/**
* Whether or not to throw an exception as soon as we exceed maxLength.
*/
private final boolean failFast;
/**
* {@code true} if we're finished decoding the proxy protocol header
*/
private boolean finished;
/**
* Protocol specification version
*/
private int version = -1;
/**
* 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 final int v2MaxHeaderSize;
/**
* Creates a new decoder with no additional data (TLV) restrictions, and should throw an exception as soon as
* we exceed maxLength.
*/
public HAProxyMessageDecoder() {
this(true);
}
Source
Frequently Asked Questions
What is the HAProxyMessageDecoder class?
HAProxyMessageDecoder is a class in the netty codebase, defined in codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessageDecoder.java.
Where is HAProxyMessageDecoder defined?
HAProxyMessageDecoder is defined in codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessageDecoder.java at line 33.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free