Home / Type/ Type Type — netty Architecture

Type Type — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  45b880b3_9439_9f75_d849_684c491dd9f1["Type"]
  6e642d30_e1eb_c142_dbe5_d22aff262e13["HAProxyTLV.java"]
  45b880b3_9439_9f75_d849_684c491dd9f1 -->|defined in| 6e642d30_e1eb_c142_dbe5_d22aff262e13
  style 45b880b3_9439_9f75_d849_684c491dd9f1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyTLV.java lines 51–116

    public enum Type {
        PP2_TYPE_ALPN,
        PP2_TYPE_AUTHORITY,
        PP2_TYPE_SSL,
        PP2_TYPE_SSL_VERSION,
        PP2_TYPE_SSL_CN,
        PP2_TYPE_NETNS,
        /**
         * A TLV type that is not officially defined in the spec. May be used for nonstandard TLVs
         */
        OTHER;

        /**
         * Returns the {@link Type} for a specific byte value as defined in the PROXY protocol 1.5 spec
         * <p>
         * If the byte value is not an official one, it will return {@link Type#OTHER}.
         *
         * @param byteValue the byte for a type
         *
         * @return the {@link Type} of a TLV
         */
        public static Type typeForByteValue(byte byteValue) {
            switch (byteValue) {
            case 0x01:
                return PP2_TYPE_ALPN;
            case 0x02:
                return PP2_TYPE_AUTHORITY;
            case 0x20:
                return PP2_TYPE_SSL;
            case 0x21:
                return PP2_TYPE_SSL_VERSION;
            case 0x22:
                return PP2_TYPE_SSL_CN;
            case 0x30:
                return PP2_TYPE_NETNS;
            default:
                return OTHER;
            }
        }

        /**
         * Returns the byte value for the {@link Type} as defined in the PROXY protocol 1.5 spec.
         *
         * @param type the {@link Type}
         *
         * @return the byte value of the {@link Type}.
         */
        public static byte byteValueForType(Type type) {
            switch (type) {
            case PP2_TYPE_ALPN:
                return 0x01;
            case PP2_TYPE_AUTHORITY:
                return 0x02;
            case PP2_TYPE_SSL:
                return 0x20;
            case PP2_TYPE_SSL_VERSION:
                return 0x21;
            case PP2_TYPE_SSL_CN:
                return 0x22;
            case PP2_TYPE_NETNS:
                return 0x30;
            default:
                throw new IllegalArgumentException("unknown type: " + type);
            }
        }
    }

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free