private void fail(List<Object> out, Exception cause) { if (!(cause instanceof DecoderException)) { cause = new DecoderException(cause); } checkpoint(State.FAILURE); Socks5Message m = new DefaultSocks5CommandRequest( Socks5CommandType.CONNECT, Socks5AddressType.IPv4, "0.0.0.0", 1); m.setDecoderResult(DecoderResult.failure(cause)); out.add(m); } }
@Override public String toString() { StringBuilder buf = new StringBuilder(128); buf.append(StringUtil.simpleClassName(this)); DecoderResult decoderResult = decoderResult(); if (!decoderResult.isSuccess()) { buf.append("(decoderResult: "); buf.append(decoderResult); buf.append(", type: "); } else { buf.append("(type: "); } buf.append(type()); buf.append(", dstAddrType: "); buf.append(dstAddrType()); buf.append(", dstAddr: "); buf.append(dstAddr()); buf.append(", dstPort: "); buf.append(dstPort()); buf.append(')'); return buf.toString(); } }
@Override public String toString() { StringBuilder buf = new StringBuilder(128); buf.append(StringUtil.simpleClassName(this)); DecoderResult decoderResult = decoderResult(); if (!decoderResult.isSuccess()) { buf.append("(decoderResult: "); buf.append(decoderResult); buf.append(", type: "); } else { buf.append("(type: "); } buf.append(type()); buf.append(", dstAddrType: "); buf.append(dstAddrType()); buf.append(", dstAddr: "); buf.append(dstAddr()); buf.append(", dstPort: "); buf.append(dstPort()); buf.append(')'); return buf.toString(); } }
private void sendConnectCommand(ChannelHandlerContext ctx) throws Exception { InetSocketAddress raddr = destinationAddress(); Socks5AddressType addrType; String rhost; if (raddr.isUnresolved()) { addrType = Socks5AddressType.DOMAIN; rhost = raddr.getHostString(); } else { rhost = raddr.getAddress().getHostAddress(); if (NetUtil.isValidIpV4Address(rhost)) { addrType = Socks5AddressType.IPv4; } else if (NetUtil.isValidIpV6Address(rhost)) { addrType = Socks5AddressType.IPv6; } else { throw new ProxyConnectException( exceptionMessage("unknown address type: " + StringUtil.simpleClassName(rhost))); } } ctx.pipeline().replace(decoderName, decoderName, new Socks5CommandResponseDecoder()); sendToProxyServer(new DefaultSocks5CommandRequest(Socks5CommandType.CONNECT, addrType, rhost, raddr.getPort())); } }
@Override public String toString() { StringBuilder buf = new StringBuilder(128); buf.append(StringUtil.simpleClassName(this)); DecoderResult decoderResult = decoderResult(); if (!decoderResult.isSuccess()) { buf.append("(decoderResult: "); buf.append(decoderResult); buf.append(", type: "); } else { buf.append("(type: "); } buf.append(type()); buf.append(", dstAddrType: "); buf.append(dstAddrType()); buf.append(", dstAddr: "); buf.append(dstAddr()); buf.append(", dstPort: "); buf.append(dstPort()); buf.append(')'); return buf.toString(); } }
final int dstPort = in.readUnsignedShort(); out.add(new DefaultSocks5CommandRequest(type, dstAddrType, dstAddr, dstPort)); checkpoint(State.SUCCESS);
@Override protected Future<?> execute() { InetSocketAddress destinationAddress = unresolvedAddressFor(serverHostAndPort); DefaultSocks5CommandRequest connectRequest = new DefaultSocks5CommandRequest( Socks5CommandType.CONNECT, Socks5AddressType.DOMAIN, destinationAddress.getHostString(), destinationAddress.getPort()); addFirstOrReplaceHandler(SOCKS_DECODER_NAME, new Socks5CommandResponseDecoder()); return writeToChannel(connectRequest); }
private void fail(List<Object> out, Exception cause) { if (!(cause instanceof DecoderException)) { cause = new DecoderException(cause); } checkpoint(State.FAILURE); Socks5Message m = new DefaultSocks5CommandRequest( Socks5CommandType.CONNECT, Socks5AddressType.IPv4, "0.0.0.0", 1); m.setDecoderResult(DecoderResult.failure(cause)); out.add(m); } }
private void fail(List<Object> out, Exception cause) { if (!(cause instanceof DecoderException)) { cause = new DecoderException(cause); } checkpoint(State.FAILURE); Socks5Message m = new DefaultSocks5CommandRequest( Socks5CommandType.CONNECT, Socks5AddressType.IPv4, "0.0.0.0", 1); m.setDecoderResult(DecoderResult.failure(cause)); out.add(m); } }
private void sendConnectCommand(ChannelHandlerContext ctx) throws Exception { InetSocketAddress raddr = destinationAddress(); Socks5AddressType addrType; String rhost; if (raddr.isUnresolved()) { addrType = Socks5AddressType.DOMAIN; rhost = raddr.getHostString(); } else { rhost = raddr.getAddress().getHostAddress(); if (NetUtil.isValidIpV4Address(rhost)) { addrType = Socks5AddressType.IPv4; } else if (NetUtil.isValidIpV6Address(rhost)) { addrType = Socks5AddressType.IPv6; } else { throw new ProxyConnectException( exceptionMessage("unknown address type: " + StringUtil.simpleClassName(rhost))); } } ctx.pipeline().replace(decoderName, decoderName, new Socks5CommandResponseDecoder()); sendToProxyServer(new DefaultSocks5CommandRequest(Socks5CommandType.CONNECT, addrType, rhost, raddr.getPort())); } }
private void sendConnectCommand(ChannelHandlerContext ctx) throws Exception { InetSocketAddress raddr = destinationAddress(); Socks5AddressType addrType; String rhost; if (raddr.isUnresolved()) { addrType = Socks5AddressType.DOMAIN; rhost = raddr.getHostString(); } else { rhost = raddr.getAddress().getHostAddress(); if (NetUtil.isValidIpV4Address(rhost)) { addrType = Socks5AddressType.IPv4; } else if (NetUtil.isValidIpV6Address(rhost)) { addrType = Socks5AddressType.IPv6; } else { throw new ProxyConnectException( exceptionMessage("unknown address type: " + StringUtil.simpleClassName(rhost))); } } ctx.pipeline().replace(decoderName, decoderName, new Socks5CommandResponseDecoder()); sendToProxyServer(new DefaultSocks5CommandRequest(Socks5CommandType.CONNECT, addrType, rhost, raddr.getPort())); } }
final int dstPort = in.readUnsignedShort(); out.add(new DefaultSocks5CommandRequest(type, dstAddrType, dstAddr, dstPort)); checkpoint(State.SUCCESS);
final int dstPort = in.readUnsignedShort(); out.add(new DefaultSocks5CommandRequest(type, dstAddrType, dstAddr, dstPort)); checkpoint(State.SUCCESS);