Home / Type/ Socks5AddressEncoder Type — netty Architecture

Socks5AddressEncoder Type — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  25684a1b_5867_51aa_fdf3_3f5ce083b138["Socks5AddressEncoder"]
  a9894bc5_4a4f_4e8e_9d4d_14a989249226["Socks5AddressEncoder.java"]
  25684a1b_5867_51aa_fdf3_3f5ce083b138 -->|defined in| a9894bc5_4a4f_4e8e_9d4d_14a989249226
  style 25684a1b_5867_51aa_fdf3_3f5ce083b138 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-socks/src/main/java/io/netty/handler/codec/socksx/v5/Socks5AddressEncoder.java lines 30–70

public interface Socks5AddressEncoder {

    Socks5AddressEncoder DEFAULT = new Socks5AddressEncoder() {
        @Override
        public void encodeAddress(Socks5AddressType addrType, String addrValue, ByteBuf out) throws Exception {
            final byte typeVal = addrType.byteValue();
            if (typeVal == Socks5AddressType.IPv4.byteValue()) {
                if (addrValue != null) {
                    out.writeBytes(NetUtil.createByteArrayFromIpAddressString(addrValue));
                } else {
                    out.writeInt(0);
                }
            } else if (typeVal == Socks5AddressType.DOMAIN.byteValue()) {
                if (addrValue != null) {
                    out.writeByte(addrValue.length());
                    out.writeCharSequence(addrValue, CharsetUtil.US_ASCII);
                } else {
                    out.writeByte(0);
                }
            } else if (typeVal == Socks5AddressType.IPv6.byteValue()) {
                if (addrValue != null) {
                    out.writeBytes(NetUtil.createByteArrayFromIpAddressString(addrValue));
                } else {
                    out.writeLong(0);
                    out.writeLong(0);
                }
            } else {
                throw new EncoderException("unsupported addrType: " + (addrType.byteValue() & 0xFF));
            }
        }
    };

    /**
     * Encodes a SOCKS5 address.
     *
     * @param addrType the type of the address
     * @param addrValue the string representation of the address
     * @param out the output buffer where the encoded SOCKS5 address field will be written to
     */
    void encodeAddress(Socks5AddressType addrType, String addrValue, ByteBuf out) throws Exception;
}

Frequently Asked Questions

What is the Socks5AddressEncoder type?
Socks5AddressEncoder is a type/interface in the netty codebase, defined in codec-socks/src/main/java/io/netty/handler/codec/socksx/v5/Socks5AddressEncoder.java.
Where is Socks5AddressEncoder defined?
Socks5AddressEncoder is defined in codec-socks/src/main/java/io/netty/handler/codec/socksx/v5/Socks5AddressEncoder.java at line 30.

Analyze Your Own Codebase

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

Try Supermodel Free