Home / Class/ Socks5IntermediaryHandler Class — netty Architecture

Socks5IntermediaryHandler Class — netty Architecture

Architecture documentation for the Socks5IntermediaryHandler class in Socks5ProxyServer.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  e4805829_de58_8fbb_f55e_e88c6b610216["Socks5IntermediaryHandler"]
  2b2df286_a481_d3ed_6921_e4b21fd7f37c["Socks5ProxyServer.java"]
  e4805829_de58_8fbb_f55e_e88c6b610216 -->|defined in| 2b2df286_a481_d3ed_6921_e4b21fd7f37c
  45ff0113_b8f6_78c9_46ff_affe5aeaae55["handleProxyProtocol()"]
  e4805829_de58_8fbb_f55e_e88c6b610216 -->|method| 45ff0113_b8f6_78c9_46ff_affe5aeaae55
  7d7cf60a_99a4_02e1_f263_c756168c7267["SocketAddress()"]
  e4805829_de58_8fbb_f55e_e88c6b610216 -->|method| 7d7cf60a_99a4_02e1_f263_c756168c7267

Relationship Graph

Source Code

handler-proxy/src/test/java/io/netty/handler/proxy/Socks5ProxyServer.java lines 165–196

    private final class Socks5IntermediaryHandler extends IntermediaryHandler {

        private boolean authenticated;
        private SocketAddress intermediaryDestination;

        @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());

            Socks5CommandResponse res =
                    new DefaultSocks5CommandResponse(Socks5CommandStatus.SUCCESS, Socks5AddressType.IPv4);
            intermediaryDestination = SocketUtils.socketAddress(req.dstAddr(), req.dstPort());

            ctx.write(res);

            ctx.pipeline().remove(ENCODER);
            ctx.pipeline().remove(DECODER);

            return true;
        }

        @Override
        protected SocketAddress intermediaryDestination() {
            return intermediaryDestination;
        }
    }

Frequently Asked Questions

What is the Socks5IntermediaryHandler class?
Socks5IntermediaryHandler is a class in the netty codebase, defined in handler-proxy/src/test/java/io/netty/handler/proxy/Socks5ProxyServer.java.
Where is Socks5IntermediaryHandler defined?
Socks5IntermediaryHandler is defined in handler-proxy/src/test/java/io/netty/handler/proxy/Socks5ProxyServer.java at line 165.

Analyze Your Own Codebase

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

Try Supermodel Free