Home / Class/ DefaultSocks4CommandResponse Class — netty Architecture

DefaultSocks4CommandResponse Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  f8d89e97_a5cf_30d0_66ac_334c1b2673ad["DefaultSocks4CommandResponse"]
  269f7361_fa17_a0c9_fde1_d7d450468f39["DefaultSocks4CommandResponse.java"]
  f8d89e97_a5cf_30d0_66ac_334c1b2673ad -->|defined in| 269f7361_fa17_a0c9_fde1_d7d450468f39
  9d38f976_5396_34b7_bf68_3b0104c32d0b["DefaultSocks4CommandResponse()"]
  f8d89e97_a5cf_30d0_66ac_334c1b2673ad -->|method| 9d38f976_5396_34b7_bf68_3b0104c32d0b
  c23bb591_9ac8_d140_117a_5e29072667f6["Socks4CommandStatus()"]
  f8d89e97_a5cf_30d0_66ac_334c1b2673ad -->|method| c23bb591_9ac8_d140_117a_5e29072667f6
  129cb63e_e74a_a725_5ca6_fa6f1b8db075["String()"]
  f8d89e97_a5cf_30d0_66ac_334c1b2673ad -->|method| 129cb63e_e74a_a725_5ca6_fa6f1b8db075
  3589f210_9fc6_21d2_6352_8b924ecac71f["dstPort()"]
  f8d89e97_a5cf_30d0_66ac_334c1b2673ad -->|method| 3589f210_9fc6_21d2_6352_8b924ecac71f

Relationship Graph

Source Code

codec-socks/src/main/java/io/netty/handler/codec/socksx/v4/DefaultSocks4CommandResponse.java lines 26–99

public class DefaultSocks4CommandResponse extends AbstractSocks4Message implements Socks4CommandResponse {

    private final Socks4CommandStatus status;
    private final String dstAddr;
    private final int dstPort;

    /**
     * Creates a new instance.
     *
     * @param status the status of the response
     */
    public DefaultSocks4CommandResponse(Socks4CommandStatus status) {
        this(status, null, 0);
    }

    /**
     * Creates a new instance.
     *
     * @param status the status of the response
     * @param dstAddr the {@code DSTIP} field of the response
     * @param dstPort the {@code DSTPORT} field of the response
     */
    public DefaultSocks4CommandResponse(Socks4CommandStatus status, String dstAddr, int dstPort) {
        if (dstAddr != null) {
            if (!NetUtil.isValidIpV4Address(dstAddr)) {
                throw new IllegalArgumentException(
                        "dstAddr: " + dstAddr + " (expected: a valid IPv4 address)");
            }
        }
        if (dstPort < 0 || dstPort > 65535) {
            throw new IllegalArgumentException("dstPort: " + dstPort + " (expected: 0~65535)");
        }

        this.status = ObjectUtil.checkNotNull(status, "cmdStatus");
        this.dstAddr = dstAddr;
        this.dstPort = dstPort;
    }

    @Override
    public Socks4CommandStatus status() {
        return status;
    }

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

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

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

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

        return buf.toString();
    }
}

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free