Note: This tool is a proof-of-concept and the code is terrible.
This tool will run a program in an isolated network namespace, and allow the program to connect only to a single TCP port such as a SOCKS proxy.
apt install uidmap iproute2
[ "$(</proc/sys/kernel/unprivileged_userns_clone)" = "0" ] && echo "You must have unprivileged user namespaces enabled"
cargo install --path .
You must have a SOCKS proxy (for example Tor) running on port 9050.
bash
socksns curl --proxy socks5h://localhost:9050 google.com
socksns torsocks curl google.com