Class Socks5UdpRelayHandler
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.ChannelDuplexHandler
com.soulfiremc.server.util.netty.Socks5UdpRelayHandler
- All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler, io.netty.channel.ChannelOutboundHandler
public class Socks5UdpRelayHandler
extends io.netty.channel.ChannelDuplexHandler
Implements SOCKS5 UDP ASSOCIATE (RFC 1928, command 0x03) for proxying UDP traffic through a SOCKS5 proxy. Used for Bedrock Edition connections which use RakNet over UDP instead of TCP.
Opens a TCP control connection to the SOCKS5 proxy for the handshake, then wraps/unwraps UDP datagrams with the SOCKS5 UDP relay header.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Constructor Summary
ConstructorsConstructorDescriptionSocks5UdpRelayHandler(InetSocketAddress proxyAddress, @Nullable String username, @Nullable String password) -
Method Summary
Modifier and TypeMethodDescriptionvoidchannelInactive(io.netty.channel.ChannelHandlerContext ctx) voidchannelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) voidconnect(io.netty.channel.ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, io.netty.channel.ChannelPromise promise) voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) voidwrite(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise) Methods inherited from class io.netty.channel.ChannelDuplexHandler
bind, close, deregister, disconnect, flush, readMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharableMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
Constructor Details
-
Socks5UdpRelayHandler
public Socks5UdpRelayHandler(InetSocketAddress proxyAddress, @Nullable String username, @Nullable String password)
-
-
Method Details
-
connect
public void connect(io.netty.channel.ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, io.netty.channel.ChannelPromise promise) - Specified by:
connectin interfaceio.netty.channel.ChannelOutboundHandler- Overrides:
connectin classio.netty.channel.ChannelDuplexHandler
-
write
-
channelRead
-
channelInactive
-
exceptionCaught
- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter
-