Socks5AddressDecoder Type — netty Architecture
Architecture documentation for the Socks5AddressDecoder type/interface in Socks5AddressDecoder.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 6a0ff8fc_2251_0ada_77a5_a37f7bfc7c0b["Socks5AddressDecoder"] 3cffc9ba_db3f_ef5a_0ef4_3067986b10d5["Socks5AddressDecoder.java"] 6a0ff8fc_2251_0ada_77a5_a37f7bfc7c0b -->|defined in| 3cffc9ba_db3f_ef5a_0ef4_3067986b10d5 style 6a0ff8fc_2251_0ada_77a5_a37f7bfc7c0b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-socks/src/main/java/io/netty/handler/codec/socksx/v5/Socks5AddressDecoder.java lines 31–71
public interface Socks5AddressDecoder {
Socks5AddressDecoder DEFAULT = new Socks5AddressDecoder() {
private static final int IPv6_LEN = 16;
@Override
public String decodeAddress(Socks5AddressType addrType, ByteBuf in) throws Exception {
if (addrType == Socks5AddressType.IPv4) {
return NetUtil.intToIpAddress(ByteBufUtil.readIntBE(in));
}
if (addrType == Socks5AddressType.DOMAIN) {
final int length = in.readUnsignedByte();
final String domain = in.toString(in.readerIndex(), length, CharsetUtil.US_ASCII);
in.skipBytes(length);
return domain;
}
if (addrType == Socks5AddressType.IPv6) {
if (in.hasArray()) {
final int readerIdx = in.readerIndex();
in.readerIndex(readerIdx + IPv6_LEN);
return NetUtil.bytesToIpAddress(in.array(), in.arrayOffset() + readerIdx, IPv6_LEN);
} else {
byte[] tmp = new byte[IPv6_LEN];
in.readBytes(tmp);
return NetUtil.bytesToIpAddress(tmp);
}
} else {
throw new DecoderException("unsupported address type: " + (addrType.byteValue() & 0xFF));
}
}
};
/**
* Decodes a SOCKS5 address field into its string representation.
*
* @param addrType the type of the address
* @param in the input buffer which contains the SOCKS5 address field at its reader index
*/
String decodeAddress(Socks5AddressType addrType, ByteBuf in) throws Exception;
}
Source
Frequently Asked Questions
What is the Socks5AddressDecoder type?
Socks5AddressDecoder is a type/interface in the netty codebase, defined in codec-socks/src/main/java/io/netty/handler/codec/socksx/v5/Socks5AddressDecoder.java.
Where is Socks5AddressDecoder defined?
Socks5AddressDecoder is defined in codec-socks/src/main/java/io/netty/handler/codec/socksx/v5/Socks5AddressDecoder.java at line 31.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free