Home / Function/ detectProtocol() — netty Function Reference

detectProtocol() — netty Function Reference

Architecture documentation for the detectProtocol() function in HAProxyMessageDecoder.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  2aff155a_12eb_fa75_8a95_74911d7789e8["detectProtocol()"]
  779adff2_46a7_a104_ccd9_84680387d552["HAProxyMessageDecoder"]
  2aff155a_12eb_fa75_8a95_74911d7789e8 -->|defined in| 779adff2_46a7_a104_ccd9_84680387d552
  5118ce8f_1171_e837_05e2_e7fad6a7ed1b["match()"]
  2aff155a_12eb_fa75_8a95_74911d7789e8 -->|calls| 5118ce8f_1171_e837_05e2_e7fad6a7ed1b
  style 2aff155a_12eb_fa75_8a95_74911d7789e8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessageDecoder.java lines 323–337

    public static ProtocolDetectionResult<HAProxyProtocolVersion> detectProtocol(ByteBuf buffer) {
        if (buffer.readableBytes() < 12) {
            return ProtocolDetectionResult.needsMoreData();
        }

        int idx = buffer.readerIndex();

        if (match(BINARY_PREFIX, buffer, idx)) {
            return DETECTION_RESULT_V2;
        }
        if (match(TEXT_PREFIX, buffer, idx)) {
            return DETECTION_RESULT_V1;
        }
        return ProtocolDetectionResult.invalid();
    }

Domain

Subdomains

Calls

Frequently Asked Questions

What does detectProtocol() do?
detectProtocol() is a function in the netty codebase, defined in codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessageDecoder.java.
Where is detectProtocol() defined?
detectProtocol() is defined in codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessageDecoder.java at line 323.
What does detectProtocol() call?
detectProtocol() calls 1 function(s): match.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free