Make SocksServer example compatible with curl --socks5-hostname
Motivation: Socks5 proxy supports resolve domain at the server side. When testing with curl, the SocksServer in example package only works for proxy request with IP, not with domain name (`--socks5` vs `--socks5-hostname`). As curl is widely used, it should work with the example provided. Modifications: Passing address and port to the Socks5CommandResponse, so that it works for curl. Result: `curl --socks5-hostname` works as expected.
This commit is contained in:
parent
00deb2efd5
commit
3a4d30df4e
@ -102,7 +102,10 @@ public final class SocksServerConnectHandler extends SimpleChannelInboundHandler
|
||||
if (future.isSuccess()) {
|
||||
ChannelFuture responseFuture =
|
||||
ctx.channel().writeAndFlush(new DefaultSocks5CommandResponse(
|
||||
Socks5CommandStatus.SUCCESS, request.dstAddrType()));
|
||||
Socks5CommandStatus.SUCCESS,
|
||||
request.dstAddrType(),
|
||||
request.dstAddr(),
|
||||
request.dstPort()));
|
||||
|
||||
responseFuture.addListener(new ChannelFutureListener() {
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user