Support direct socks proxy without ssh

This commit is contained in:
2025-02-27 11:05:11 -05:00
parent b61950cc40
commit e1c8128d02
4 changed files with 31 additions and 8 deletions

View File

@@ -7,13 +7,19 @@ pidfile=${RUNTIME_DIRECTORY:-/tmp}/tunsocks.pid
nsname="$1"
device="tun${nsname}"
ns="${nsname}ns"
socketpath="/run/nnss-${nsname}/sock"
if [ "$2" = use_env ];then
proxy="$SOCKS_PROXY"
shift
else
proxy="socks5:///run/nnss-${nsname}/sock"
fi
setup()
{
ip tuntap add mode tun dev "$device"
/usr/bin/tun2socks -device "$device" -proxy "socks5://$socketpath" &
/usr/bin/tun2socks -device "$device" -proxy "$proxy" &
echo "$!" > "$pidfile"
sleep 5