Socks5TerminalHandler Class — netty Architecture
Architecture documentation for the Socks5TerminalHandler class in Socks5ProxyServer.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 45648d14_0457_7c46_85c2_3fae5c2b12e7["Socks5TerminalHandler"] 2b2df286_a481_d3ed_6921_e4b21fd7f37c["Socks5ProxyServer.java"] 45648d14_0457_7c46_85c2_3fae5c2b12e7 -->|defined in| 2b2df286_a481_d3ed_6921_e4b21fd7f37c 8d894358_6082_45ac_0214_3983ac1b3788["handleProxyProtocol()"] 45648d14_0457_7c46_85c2_3fae5c2b12e7 -->|method| 8d894358_6082_45ac_0214_3983ac1b3788
Relationship Graph
Source Code
handler-proxy/src/test/java/io/netty/handler/proxy/Socks5ProxyServer.java lines 198–235
private final class Socks5TerminalHandler extends TerminalHandler {
private boolean authenticated;
@Override
protected boolean handleProxyProtocol(ChannelHandlerContext ctx, Object msg) throws Exception {
if (!authenticated) {
authenticated = authenticate(ctx, msg);
return false;
}
Socks5CommandRequest req = (Socks5CommandRequest) msg;
assertEquals(Socks5CommandType.CONNECT, req.type());
ctx.pipeline().addBefore(ctx.name(), "lineDecoder", new LineBasedFrameDecoder(64, false, true));
Socks5CommandResponse res;
boolean sendGreeting = false;
if (!req.dstAddr().equals(destination.getHostString()) ||
req.dstPort() != destination.getPort()) {
res = new DefaultSocks5CommandResponse(Socks5CommandStatus.FORBIDDEN, Socks5AddressType.IPv4);
} else {
res = new DefaultSocks5CommandResponse(Socks5CommandStatus.SUCCESS, Socks5AddressType.IPv4);
sendGreeting = true;
}
ctx.write(res);
ctx.pipeline().remove(ENCODER);
ctx.pipeline().remove(DECODER);
if (sendGreeting) {
ctx.write(Unpooled.copiedBuffer("0\n", CharsetUtil.US_ASCII));
}
return true;
}
}
Source
Frequently Asked Questions
What is the Socks5TerminalHandler class?
Socks5TerminalHandler is a class in the netty codebase, defined in handler-proxy/src/test/java/io/netty/handler/proxy/Socks5ProxyServer.java.
Where is Socks5TerminalHandler defined?
Socks5TerminalHandler is defined in handler-proxy/src/test/java/io/netty/handler/proxy/Socks5ProxyServer.java at line 198.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free