Skip to content
Redirect traffic to SOCKS5 server with iptables, epoll based, single threaded.
C C++ Shell Makefile
Find file

Simple Linux epoll-based single thread SOCKS5 client. Supports getting destination address with SO_ORIGINAL_DST (for use with -j REDIRECT iptables target) and telling that address to SOCKS server.

Author page:

Alternative, more complete libevent-based implementation: redsocks

Example setup:

# # Prepare iptables:
# iptables -t nat -N QQQ
# iptables -t nat -A QQQ -d -p tcp --dport 22 -j RETURN
# iptables -t nat -A QQQ -p tcp -j REDIRECT --to-ports 1234
# iptables -t nat -I OUTPUT 1 -j QQQ
# iptables -t nat -I PREROUTING 1 -j QQQ

$ # connect to SSH:
$ ssh -D vi@

$ # start tcpsocks:
$ tcpsocks 1234 REDIRECT REDIRECT 1080 -> [5->6] -> [5->6] Started -> [5->6] Finished -> [5->6] -> [5->6] Started -> [17->18] -> [13->14] tcpsocks: End of file from SOCKS5 server [phase 3] -> [13->14] Finished
Commands: quit list kill Debug
l -> [5->6] 2317:425
k 5 -> [5->6] Finished

tcpsocks allow interactive control of connections: you can list then and kill (by specifying fd). When listing, it prints uploaded/downloaded bytes for each connection.

tcpsocks does not require configuration expect of command line parameters.

You can't limit connection speed, use tcplim for this.

Something went wrong with that request. Please try again.