Home / Type/ HAProxyCommand Type — netty Architecture

HAProxyCommand Type — netty Architecture

Architecture documentation for the HAProxyCommand type/interface in HAProxyCommand.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  58e359e2_aa07_cd43_541a_e3a3c27698e5["HAProxyCommand"]
  a2f2cfe7_a3c5_4bc0_5fc2_4fefcc82a813["HAProxyCommand.java"]
  58e359e2_aa07_cd43_541a_e3a3c27698e5 -->|defined in| a2f2cfe7_a3c5_4bc0_5fc2_4fefcc82a813
  style 58e359e2_aa07_cd43_541a_e3a3c27698e5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyCommand.java lines 21–70

public enum HAProxyCommand {
    /**
     * The LOCAL command represents a connection that was established on purpose by the proxy
     * without being relayed.
     */
    LOCAL(HAProxyConstants.COMMAND_LOCAL_BYTE),
    /**
     * The PROXY command represents a connection that was established on behalf of another node,
     * and reflects the original connection endpoints.
     */
    PROXY(HAProxyConstants.COMMAND_PROXY_BYTE);

    /**
     * The command is specified in the lowest 4 bits of the protocol version and command byte
     */
    private static final byte COMMAND_MASK = 0x0f;

    private final byte byteValue;

    /**
     * Creates a new instance
     */
    HAProxyCommand(byte byteValue) {
        this.byteValue = byteValue;
    }

    /**
     * Returns the {@link HAProxyCommand} represented by the lowest 4 bits of the specified byte.
     *
     * @param verCmdByte protocol version and command byte
     */
    public static HAProxyCommand valueOf(byte verCmdByte) {
        int cmd = verCmdByte & COMMAND_MASK;
        switch ((byte) cmd) {
            case HAProxyConstants.COMMAND_PROXY_BYTE:
                return PROXY;
            case HAProxyConstants.COMMAND_LOCAL_BYTE:
                return LOCAL;
            default:
                throw new IllegalArgumentException("unknown command: " + cmd);
        }
    }

    /**
     * Returns the byte value of this command.
     */
    public byte byteValue() {
        return byteValue;
    }
}

Frequently Asked Questions

What is the HAProxyCommand type?
HAProxyCommand is a type/interface in the netty codebase, defined in codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyCommand.java.
Where is HAProxyCommand defined?
HAProxyCommand is defined in codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyCommand.java at line 21.

Analyze Your Own Codebase

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

Try Supermodel Free