Home / Function/ handleProxyProtocol() — netty Function Reference

handleProxyProtocol() — netty Function Reference

Architecture documentation for the handleProxyProtocol() function in Socks5ProxyServer.java from the netty codebase.

Function java Buffer Allocators calls 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  8d894358_6082_45ac_0214_3983ac1b3788["handleProxyProtocol()"]
  45648d14_0457_7c46_85c2_3fae5c2b12e7["Socks5TerminalHandler"]
  8d894358_6082_45ac_0214_3983ac1b3788 -->|defined in| 45648d14_0457_7c46_85c2_3fae5c2b12e7
  45ff0113_b8f6_78c9_46ff_affe5aeaae55["handleProxyProtocol()"]
  45ff0113_b8f6_78c9_46ff_affe5aeaae55 -->|calls| 8d894358_6082_45ac_0214_3983ac1b3788
  45ff0113_b8f6_78c9_46ff_affe5aeaae55["handleProxyProtocol()"]
  8d894358_6082_45ac_0214_3983ac1b3788 -->|calls| 45ff0113_b8f6_78c9_46ff_affe5aeaae55
  296d9c5e_12d0_8d1b_d9da_27490a48a43b["authenticate()"]
  8d894358_6082_45ac_0214_3983ac1b3788 -->|calls| 296d9c5e_12d0_8d1b_d9da_27490a48a43b
  style 8d894358_6082_45ac_0214_3983ac1b3788 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler-proxy/src/test/java/io/netty/handler/proxy/Socks5ProxyServer.java lines 202–234

        @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;
        }

Domain

Subdomains

Frequently Asked Questions

What does handleProxyProtocol() do?
handleProxyProtocol() is a function in the netty codebase, defined in handler-proxy/src/test/java/io/netty/handler/proxy/Socks5ProxyServer.java.
Where is handleProxyProtocol() defined?
handleProxyProtocol() is defined in handler-proxy/src/test/java/io/netty/handler/proxy/Socks5ProxyServer.java at line 202.
What does handleProxyProtocol() call?
handleProxyProtocol() calls 2 function(s): authenticate, handleProxyProtocol.
What calls handleProxyProtocol()?
handleProxyProtocol() is called by 1 function(s): handleProxyProtocol.

Analyze Your Own Codebase

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

Try Supermodel Free