@Override public void encodeAsByteBuf(ByteBuf byteBuf) { byteBuf.writeByte(protocolVersion().byteValue()); byteBuf.writeByte(cmdType.byteValue()); byteBuf.writeByte(0x00); byteBuf.writeByte(addressType.byteValue()); switch (addressType) { case IPv4: { byteBuf.writeBytes(NetUtil.createByteArrayFromIpAddressString(host)); byteBuf.writeShort(port); break; } case DOMAIN: { byteBuf.writeByte(host.length()); byteBuf.writeCharSequence(host, CharsetUtil.US_ASCII); byteBuf.writeShort(port); break; } case IPv6: { byteBuf.writeBytes(NetUtil.createByteArrayFromIpAddressString(host)); byteBuf.writeShort(port); break; } } } }
/** * @deprecated Use {@link #valueOf(byte)} instead. */ @Deprecated public static SocksAddressType fromByte(byte b) { return valueOf(b); }
public static SocksAddressType valueOf(byte b) { for (SocksAddressType code : values()) { if (code.b == b) { return code; } } return UNKNOWN; }
byteBuf.writeByte(cmdStatus.byteValue()); byteBuf.writeByte(0x00); byteBuf.writeByte(addressType.byteValue()); switch (addressType) { case IPv4: {
cmdType = SocksCmdType.valueOf(byteBuf.readByte()); byteBuf.skipBytes(1); // reserved addressType = SocksAddressType.valueOf(byteBuf.readByte()); checkpoint(State.READ_CMD_ADDRESS);
public static SocksAddressType valueOf(byte b) { for (SocksAddressType code : values()) { if (code.b == b) { return code; } } return UNKNOWN; }
public void encodeAsByteBuf(ByteBuf byteBuf) { byteBuf.writeByte(this.addressType.byteValue()); switch(this.addressType) { case IPv4: byteBuf.writeBytes(NetUtil.createByteArrayFromIpAddressString(this.host)); byteBuf.writeShort(this.port); break; case DOMAIN: byteBuf.writeByte(this.host.length()); byteBuf.writeBytes(this.host.getBytes(CharsetUtil.US_ASCII)); byteBuf.writeShort(this.port); break; case IPv6: byteBuf.writeBytes(NetUtil.createByteArrayFromIpAddressString(this.host)); byteBuf.writeShort(this.port); } }
cmdStatus = SocksCmdStatus.valueOf(byteBuf.readByte()); byteBuf.skipBytes(1); // reserved addressType = SocksAddressType.valueOf(byteBuf.readByte()); checkpoint(State.READ_CMD_ADDRESS);
public static SocksAddressType valueOf(byte b) { for (SocksAddressType code : values()) { if (code.b == b) { return code; } } return UNKNOWN; }
@Override public void encodeAsByteBuf(ByteBuf byteBuf) { byteBuf.writeByte(protocolVersion().byteValue()); byteBuf.writeByte(cmdType.byteValue()); byteBuf.writeByte(0x00); byteBuf.writeByte(addressType.byteValue()); switch (addressType) { case IPv4: { byteBuf.writeBytes(NetUtil.createByteArrayFromIpAddressString(host)); byteBuf.writeShort(port); break; } case DOMAIN: { byteBuf.writeByte(host.length()); byteBuf.writeCharSequence(host, CharsetUtil.US_ASCII); byteBuf.writeShort(port); break; } case IPv6: { byteBuf.writeBytes(NetUtil.createByteArrayFromIpAddressString(host)); byteBuf.writeShort(port); break; } } } }
/** * @deprecated Use {@link #valueOf(byte)} instead. */ @Deprecated public static SocksAddressType fromByte(byte b) { return valueOf(b); }
@Override public void encodeAsByteBuf(ByteBuf byteBuf) { byteBuf.writeByte(protocolVersion().byteValue()); byteBuf.writeByte(cmdType.byteValue()); byteBuf.writeByte(0x00); byteBuf.writeByte(addressType.byteValue()); switch (addressType) { case IPv4: { byteBuf.writeBytes(NetUtil.createByteArrayFromIpAddressString(host)); byteBuf.writeShort(port); break; } case DOMAIN: { byteBuf.writeByte(host.length()); byteBuf.writeCharSequence(host, CharsetUtil.US_ASCII); byteBuf.writeShort(port); break; } case IPv6: { byteBuf.writeBytes(NetUtil.createByteArrayFromIpAddressString(host)); byteBuf.writeShort(port); break; } } } }
/** * @deprecated Use {@link #valueOf(byte)} instead. */ @Deprecated public static SocksAddressType fromByte(byte b) { return valueOf(b); }
byteBuf.writeByte(cmdStatus.byteValue()); byteBuf.writeByte(0x00); byteBuf.writeByte(addressType.byteValue()); switch (addressType) { case IPv4: {
remoteChannel = future.channel(); SSAddrRequest ssAddr = new SSAddrRequest(SocksAddressType.valueOf(this.remoteAddr.dstAddrType().byteValue()), this.remoteAddr.dstAddr(), this.remoteAddr.dstPort()); ByteBuf addrBuff = Unpooled.buffer(128); ssAddr.encodeAsByteBuf(addrBuff);
byteBuf.writeByte(cmdStatus.byteValue()); byteBuf.writeByte(0x00); byteBuf.writeByte(addressType.byteValue()); switch (addressType) { case IPv4: {
cmdStatus = SocksCmdStatus.valueOf(byteBuf.readByte()); byteBuf.skipBytes(1); // reserved addressType = SocksAddressType.valueOf(byteBuf.readByte()); checkpoint(State.READ_CMD_ADDRESS);
int port = 0; int addressType = dataBuff.getUnsignedByte(0); if (addressType == SocksAddressType.IPv4.byteValue()) { if (dataBuff.readableBytes() < 7) { return; host = InetAddress.getByAddress(ipBytes).toString().substring(1); port = dataBuff.readShort(); } else if (addressType == SocksAddressType.DOMAIN.byteValue()) { int hostLength = dataBuff.getUnsignedByte(1); if (dataBuff.readableBytes() < hostLength + 4) {
cmdType = SocksCmdType.valueOf(byteBuf.readByte()); byteBuf.skipBytes(1); // reserved addressType = SocksAddressType.valueOf(byteBuf.readByte()); checkpoint(State.READ_CMD_ADDRESS);
cmdType = SocksCmdType.valueOf(byteBuf.readByte()); byteBuf.skipBytes(1); // reserved addressType = SocksAddressType.valueOf(byteBuf.readByte()); checkpoint(State.READ_CMD_ADDRESS);