#!/bin/sh set -e PROXYCHAINS_CONFIG_FILE="${PROXYCHAINS_CONFIG_FILE:-/etc/proxychains.conf}" setup_proxychains() { if [ "${ENABLE_PROXYCHAINS}" != "1" ]; then echo "proxychains disabled (ENABLE_PROXYCHAINS=${ENABLE_PROXYCHAINS:-0})" return 0 fi if ! command -v proxychains4 >/dev/null 2>&1; then echo "proxychains4 is not installed but ENABLE_PROXYCHAINS=1 was set." >&2 exit 1 fi proxy_type="${PROXYCHAINS_PROXY_TYPE:-socks4}" proxy_host="${PROXYCHAINS_PROXY_HOST:-host.docker.internal}" proxy_port="${PROXYCHAINS_PROXY_PORT:-10808}" chain_mode="${PROXYCHAINS_CHAIN_MODE:-strict_chain}" proxy_ip="$(getent hosts "${proxy_host}" | awk 'NR==1 {print $1}')" if [ -z "${proxy_ip}" ]; then echo "Could not resolve proxy host: ${proxy_host}" >&2 exit 1 fi cat > "${PROXYCHAINS_CONFIG_FILE}" <