Home / Class/ Socks5AuthMethod Class — netty Architecture

Socks5AuthMethod Class — netty Architecture

Architecture documentation for the Socks5AuthMethod class in Socks5AuthMethod.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  1916b0ee_c664_abf0_4992_02ece7bcdd8d["Socks5AuthMethod"]
  9b1824e0_0384_ba47_8da6_2bb8c7c36639["Socks5AuthMethod.java"]
  1916b0ee_c664_abf0_4992_02ece7bcdd8d -->|defined in| 9b1824e0_0384_ba47_8da6_2bb8c7c36639
  64125704_4d73_b51c_342e_fd4a4098752e["isPrivateMethod()"]
  1916b0ee_c664_abf0_4992_02ece7bcdd8d -->|method| 64125704_4d73_b51c_342e_fd4a4098752e
  eafd4fd3_dab7_2e4d_60d7_7e7388cd7900["Socks5AuthMethod()"]
  1916b0ee_c664_abf0_4992_02ece7bcdd8d -->|method| eafd4fd3_dab7_2e4d_60d7_7e7388cd7900
  a8c7a0f2_bbdf_a10d_bea7_89698fd5ac53["byteValue()"]
  1916b0ee_c664_abf0_4992_02ece7bcdd8d -->|method| a8c7a0f2_bbdf_a10d_bea7_89698fd5ac53
  6ae3ecd8_11dc_5b7a_9587_259d025d8f9a["hashCode()"]
  1916b0ee_c664_abf0_4992_02ece7bcdd8d -->|method| 6ae3ecd8_11dc_5b7a_9587_259d025d8f9a
  cad49d90_da74_54f9_16dd_aaa290bbda39["equals()"]
  1916b0ee_c664_abf0_4992_02ece7bcdd8d -->|method| cad49d90_da74_54f9_16dd_aaa290bbda39
  0a2230ed_4936_ef61_e3ac_053a41ff9213["compareTo()"]
  1916b0ee_c664_abf0_4992_02ece7bcdd8d -->|method| 0a2230ed_4936_ef61_e3ac_053a41ff9213
  b8621d2a_a5ee_69d8_580e_65af51956311["String()"]
  1916b0ee_c664_abf0_4992_02ece7bcdd8d -->|method| b8621d2a_a5ee_69d8_580e_65af51956311

Relationship Graph

Source Code

codec-socks/src/main/java/io/netty/handler/codec/socksx/v5/Socks5AuthMethod.java lines 24–111

public class Socks5AuthMethod implements Comparable<Socks5AuthMethod> {

    public static final Socks5AuthMethod NO_AUTH = new Socks5AuthMethod(0x00, "NO_AUTH");
    public static final Socks5AuthMethod GSSAPI = new Socks5AuthMethod(0x01, "GSSAPI");
    public static final Socks5AuthMethod PASSWORD = new Socks5AuthMethod(0x02, "PASSWORD");

    /**
     * Indicates that the server does not accept any authentication methods the client proposed.
     */
    public static final Socks5AuthMethod UNACCEPTED = new Socks5AuthMethod(0xff, "UNACCEPTED");

    /**
     * Returns whether the authentication method code is in the private methods range (0x80-0xFE)
     * as defined by <a href="https://www.ietf.org/rfc/rfc1928.txt">RFC 1928 section 3</a>.
     *
     * @param b The authentication method code
     * @return true if the code is in the private methods range
     */
    public static boolean isPrivateMethod(byte b) {
        int ubyte = b & 0xFF;
        return ubyte >= 0x80 && ubyte <= 0xFE;
    }

    public static Socks5AuthMethod valueOf(byte b) {
        switch (b) {
        case 0x00:
            return NO_AUTH;
        case 0x01:
            return GSSAPI;
        case 0x02:
            return PASSWORD;
        case (byte) 0xFF:
            return UNACCEPTED;
        }

        // Handle all private methods (0x80-0xFE)
        if (isPrivateMethod(b)) {
            return new Socks5AuthMethod(b, "PRIVATE_" + (b & 0xFF));
        }

        return new Socks5AuthMethod(b);
    }

    private final byte byteValue;
    private final String name;
    private String text;

    public Socks5AuthMethod(int byteValue) {
        this(byteValue, "UNKNOWN");
    }

    public Socks5AuthMethod(int byteValue, String name) {
        this.name = ObjectUtil.checkNotNull(name, "name");
        this.byteValue = (byte) byteValue;
    }

    public byte byteValue() {
        return byteValue;
    }

    @Override
    public int hashCode() {
        return byteValue;
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof Socks5AuthMethod)) {
            return false;
        }

        return byteValue == ((Socks5AuthMethod) obj).byteValue;
    }

    @Override
    public int compareTo(Socks5AuthMethod o) {
        return byteValue - o.byteValue;
    }

    @Override
    public String toString() {

Frequently Asked Questions

What is the Socks5AuthMethod class?
Socks5AuthMethod is a class in the netty codebase, defined in codec-socks/src/main/java/io/netty/handler/codec/socksx/v5/Socks5AuthMethod.java.
Where is Socks5AuthMethod defined?
Socks5AuthMethod is defined in codec-socks/src/main/java/io/netty/handler/codec/socksx/v5/Socks5AuthMethod.java at line 24.

Analyze Your Own Codebase

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

Try Supermodel Free