#!/bin/bash -e stopwg() { wg-quick down "$CONF" } # See https://mullvad.net/en/help/socks5-proxy SOCKS_IP='10.64.0.1' CONF="$(printf '%q\n' /etc/wireguard/*.conf | shuf -n1)" sed -i "s/^AllowedIPs.*/AllowedIPs = $SOCKS_IP/" /etc/wireguard/*.conf wg-quick up "$CONF" trap stopwg SIGHUP SIGINT SIGTERM sleep infinity & wait