Home / Class/ DefaultSocks4CommandRequest Class — netty Architecture

DefaultSocks4CommandRequest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  91b0262b_3066_f584_afb4_53d38c6df9ef["DefaultSocks4CommandRequest"]
  dd9fb002_5949_ab23_68aa_4f2fe0083fb1["DefaultSocks4CommandRequest.java"]
  91b0262b_3066_f584_afb4_53d38c6df9ef -->|defined in| dd9fb002_5949_ab23_68aa_4f2fe0083fb1
  18471166_f499_533a_5610_ad3e53892d01["DefaultSocks4CommandRequest()"]
  91b0262b_3066_f584_afb4_53d38c6df9ef -->|method| 18471166_f499_533a_5610_ad3e53892d01
  acaec008_3a8f_8a43_3949_0ae388aab6f1["Socks4CommandType()"]
  91b0262b_3066_f584_afb4_53d38c6df9ef -->|method| acaec008_3a8f_8a43_3949_0ae388aab6f1
  d1609eac_795b_321c_f399_1d9a56d8a58f["String()"]
  91b0262b_3066_f584_afb4_53d38c6df9ef -->|method| d1609eac_795b_321c_f399_1d9a56d8a58f
  b3118509_d883_7b87_d8a2_2653be4b3a6e["dstPort()"]
  91b0262b_3066_f584_afb4_53d38c6df9ef -->|method| b3118509_d883_7b87_d8a2_2653be4b3a6e

Relationship Graph

Source Code

codec-socks/src/main/java/io/netty/handler/codec/socksx/v4/DefaultSocks4CommandRequest.java lines 27–108

public class DefaultSocks4CommandRequest extends AbstractSocks4Message implements Socks4CommandRequest {

    private final Socks4CommandType type;
    private final String dstAddr;
    private final int dstPort;
    private final String userId;

    /**
     * Creates a new instance.
     *
     * @param type the type of the request
     * @param dstAddr the {@code DSTIP} field of the request
     * @param dstPort the {@code DSTPORT} field of the request
     */
    public DefaultSocks4CommandRequest(Socks4CommandType type, String dstAddr, int dstPort) {
        this(type, dstAddr, dstPort, "");
    }

    /**
     * Creates a new instance.
     *
     * @param type the type of the request
     * @param dstAddr the {@code DSTIP} field of the request
     * @param dstPort the {@code DSTPORT} field of the request
     * @param userId the {@code USERID} field of the request
     */
    public DefaultSocks4CommandRequest(Socks4CommandType type, String dstAddr, int dstPort, String userId) {
        if (dstPort <= 0 || dstPort >= 65536) {
            throw new IllegalArgumentException("dstPort: " + dstPort + " (expected: 1~65535)");
        }
        this.type = ObjectUtil.checkNotNull(type, "type");
        this.dstAddr = IDN.toASCII(
                ObjectUtil.checkNotNull(dstAddr, "dstAddr"));
        this.userId = ObjectUtil.checkNotNull(userId, "userId");
        this.dstPort = dstPort;
    }

    @Override
    public Socks4CommandType type() {
        return type;
    }

    @Override
    public String dstAddr() {
        return dstAddr;
    }

    @Override
    public int dstPort() {
        return dstPort;
    }

    @Override
    public String userId() {
        return userId;
    }

    @Override
    public String toString() {
        StringBuilder buf = new StringBuilder(128);
        buf.append(StringUtil.simpleClassName(this));

        DecoderResult decoderResult = decoderResult();
        if (!decoderResult.isSuccess()) {
            buf.append("(decoderResult: ");
            buf.append(decoderResult);
            buf.append(", type: ");
        } else {
            buf.append("(type: ");
        }
        buf.append(type());
        buf.append(", dstAddr: ");
        buf.append(dstAddr());
        buf.append(", dstPort: ");
        buf.append(dstPort());
        buf.append(", userId: ");
        buf.append(userId());
        buf.append(')');

        return buf.toString();
    }

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free