private void encodeCommandRequest(Socks5CommandRequest msg, ByteBuf out) throws Exception { out.writeByte(msg.version().byteValue()); out.writeByte(msg.type().byteValue()); out.writeByte(0x00); final Socks5AddressType dstAddrType = msg.dstAddrType(); out.writeByte(dstAddrType.byteValue()); addressEncoder.encodeAddress(dstAddrType, msg.dstAddr(), out); out.writeShort(msg.dstPort()); } }
private void handleCommandRequest(ChannelHandlerContext ctx, final Socks5CommandRequest commandRequest) { if (commandRequest.type().equals(Socks5CommandType.CONNECT)) { forwardConnection(ctx, new Socks5ConnectHandler(server, mockServerLogger, commandRequest.dstAddr(), commandRequest.dstPort()), commandRequest.dstAddr(), commandRequest.dstPort()); ctx.fireChannelRead(commandRequest); } else { ctx.writeAndFlush(new DefaultSocks5CommandResponse(Socks5CommandStatus.COMMAND_UNSUPPORTED, Socks5AddressType.DOMAIN, "", 0)).addListener(ChannelFutureListener.CLOSE); } } }
private void encodeCommandRequest(Socks5CommandRequest msg, ByteBuf out) throws Exception { out.writeByte(msg.version().byteValue()); out.writeByte(msg.type().byteValue()); out.writeByte(0x00); final Socks5AddressType dstAddrType = msg.dstAddrType(); out.writeByte(dstAddrType.byteValue()); addressEncoder.encodeAddress(dstAddrType, msg.dstAddr(), out); out.writeShort(msg.dstPort()); } }
private void encodeCommandRequest(Socks5CommandRequest msg, ByteBuf out) throws Exception { out.writeByte(msg.version().byteValue()); out.writeByte(msg.type().byteValue()); out.writeByte(0x00); final Socks5AddressType dstAddrType = msg.dstAddrType(); out.writeByte(dstAddrType.byteValue()); addressEncoder.encodeAddress(dstAddrType, msg.dstAddr(), out); out.writeShort(msg.dstPort()); } }
private void handleCommandRequest(ChannelHandlerContext ctx, final Socks5CommandRequest commandRequest) { if (commandRequest.type().equals(Socks5CommandType.CONNECT)) { forwardConnection(ctx, new Socks5ConnectHandler(server, mockServerLogger, commandRequest.dstAddr(), commandRequest.dstPort()), commandRequest.dstAddr(), commandRequest.dstPort()); ctx.fireChannelRead(commandRequest); } else { ctx.writeAndFlush(new DefaultSocks5CommandResponse(Socks5CommandStatus.COMMAND_UNSUPPORTED, Socks5AddressType.DOMAIN, "", 0)).addListener(ChannelFutureListener.CLOSE); } } }
} else if (socksMessage instanceof Socks5CommandRequest) { Socks5CommandRequest socks5CmdRequest = (Socks5CommandRequest) socksMessage; if (socks5CmdRequest.type() == Socks5CommandType.CONNECT) { onSocksSuccess(ctx, socks5CmdRequest); } else {
if (request.type().equals(Socks5CommandType.CONNECT)) { try { handleConnectRequest(ctx, request.dstAddr(), request.dstPort(),
if (request.type().equals(Socks5CommandType.CONNECT)) { try { handleConnectRequest(ctx, request.dstAddr(), request.dstPort(),