forked from ports/contrib
22 lines
472 B
Bash
Executable File
22 lines
472 B
Bash
Executable File
#!/bin/sh -
|
|
#@ usocks - detour network traffic through SOCKS5 proxy.
|
|
#@
|
|
#@ Synopsis: usocks PROXY-ADDRESS PROXY-PORT COMMAND [:ARGS:]
|
|
#
|
|
# Public Domain
|
|
|
|
ld_preload=/usr/lib/preloadable-usocks.so
|
|
|
|
if [ ${#} -lt 3 ]; then
|
|
echo >&2 'Synopsis: usocks PROXY-ADDRESS PROXY-PORT COMMAND [:ARGS:]'
|
|
exit 64 # EX_USAGE
|
|
fi
|
|
|
|
USOCKS_ADDR=${1} USOCKS_PORT=${2} cmd=${3}
|
|
shift 3
|
|
|
|
LD_PRELOAD="${ld_preload} ${LD_PRELOAD}"
|
|
|
|
export USOCKS_ADDR USOCKS_PORT LD_PRELOAD
|
|
exec "${cmd}" "${@}"
|