@Override public String decodeAddress(Socks5AddressType addrType, ByteBuf in) throws Exception { if (addrType == Socks5AddressType.IPv4) { return NetUtil.intToIpAddress(in.readInt()); } if (addrType == Socks5AddressType.DOMAIN) { final int length = in.readUnsignedByte(); final String domain = in.toString(in.readerIndex(), length, CharsetUtil.US_ASCII); in.skipBytes(length); return domain; } if (addrType == Socks5AddressType.IPv6) { if (in.hasArray()) { final int readerIdx = in.readerIndex(); in.readerIndex(readerIdx + IPv6_LEN); return NetUtil.bytesToIpAddress(in.array(), in.arrayOffset() + readerIdx, IPv6_LEN); } else { byte[] tmp = new byte[IPv6_LEN]; in.readBytes(tmp); return NetUtil.bytesToIpAddress(tmp); } } else { throw new DecoderException("unsupported address type: " + (addrType.byteValue() & 0xFF)); } } };
switch (addressType) { case IPv4: { String host = NetUtil.intToIpAddress(byteBuf.readInt()); int port = byteBuf.readUnsignedShort(); out.add(new SocksCmdRequest(cmdType, addressType, host, port));
switch (addressType) { case IPv4: { String host = NetUtil.intToIpAddress(byteBuf.readInt()); int port = byteBuf.readUnsignedShort(); out.add(new SocksCmdResponse(cmdStatus, addressType, host, port));
final String dstAddr = NetUtil.intToIpAddress(in.readInt());
dstAddr = NetUtil.intToIpAddress(in.readInt()); checkpoint(State.READ_USERID);
@Override public String decodeAddress(Socks5AddressType addrType, ByteBuf in) throws Exception { if (addrType == Socks5AddressType.IPv4) { return NetUtil.intToIpAddress(in.readInt()); } if (addrType == Socks5AddressType.DOMAIN) { final int length = in.readUnsignedByte(); final String domain = in.toString(in.readerIndex(), length, CharsetUtil.US_ASCII); in.skipBytes(length); return domain; } if (addrType == Socks5AddressType.IPv6) { if (in.hasArray()) { final int readerIdx = in.readerIndex(); in.readerIndex(readerIdx + IPv6_LEN); return NetUtil.bytesToIpAddress(in.array(), in.arrayOffset() + readerIdx, IPv6_LEN); } else { byte[] tmp = new byte[IPv6_LEN]; in.readBytes(tmp); return NetUtil.bytesToIpAddress(tmp); } } else { throw new DecoderException("unsupported address type: " + (addrType.byteValue() & 0xFF)); } } };
@Override public String decodeAddress(Socks5AddressType addrType, ByteBuf in) throws Exception { if (addrType == Socks5AddressType.IPv4) { return NetUtil.intToIpAddress(in.readInt()); } if (addrType == Socks5AddressType.DOMAIN) { final int length = in.readUnsignedByte(); final String domain = in.toString(in.readerIndex(), length, CharsetUtil.US_ASCII); in.skipBytes(length); return domain; } if (addrType == Socks5AddressType.IPv6) { if (in.hasArray()) { final int readerIdx = in.readerIndex(); in.readerIndex(readerIdx + IPv6_LEN); return NetUtil.bytesToIpAddress(in.array(), in.arrayOffset() + readerIdx, IPv6_LEN); } else { byte[] tmp = new byte[IPv6_LEN]; in.readBytes(tmp); return NetUtil.bytesToIpAddress(tmp); } } else { throw new DecoderException("unsupported address type: " + (addrType.byteValue() & 0xFF)); } } };
switch (addressType) { case IPv4: { String host = NetUtil.intToIpAddress(byteBuf.readInt()); int port = byteBuf.readUnsignedShort(); out.add(new SocksCmdResponse(cmdStatus, addressType, host, port));
switch (addressType) { case IPv4: { String host = NetUtil.intToIpAddress(byteBuf.readInt()); int port = byteBuf.readUnsignedShort(); out.add(new SocksCmdRequest(cmdType, addressType, host, port));
switch (addressType) { case IPv4: { String host = NetUtil.intToIpAddress(byteBuf.readInt()); int port = byteBuf.readUnsignedShort(); out.add(new SocksCmdResponse(cmdStatus, addressType, host, port));
switch (addressType) { case IPv4: { String host = NetUtil.intToIpAddress(byteBuf.readInt()); int port = byteBuf.readUnsignedShort(); out.add(new SocksCmdRequest(cmdType, addressType, host, port));
final String dstAddr = NetUtil.intToIpAddress(in.readInt());
final String dstAddr = NetUtil.intToIpAddress(in.readInt());
dstAddr = NetUtil.intToIpAddress(in.readInt()); checkpoint(State.READ_USERID);
dstAddr = NetUtil.intToIpAddress(in.readInt()); checkpoint(State.READ_USERID);