pages-server/local_test
hazel b53a9d9e74
All checks were successful
Deploy to VPS / build_site (push) Successful in 6s
exit on error local_test
2024-04-03 18:02:07 -05:00

33 lines
1.8 KiB
Bash
Executable file

#!/usr/bin/env sh
set -e
PAGES_GAY_IPV4='66.94.102.77'
PAGES_GAY_IPV6='2605:a142:2135:4519::1'
COMMAND=${1:-"start"}
if [ $COMMAND == "stop" ]
then
echo removing map
sudo iptables -t nat -D OUTPUT -p tcp -d $PAGES_GAY_IPV4 --dport 80 -j REDIRECT --to-ports 3080
sudo iptables -t nat -D OUTPUT -p tcp -d $PAGES_GAY_IPV4 --dport 443 -j REDIRECT --to-ports 3443
sudo iptables -t nat -D OUTPUT -p udp -d $PAGES_GAY_IPV4 --dport 80 -j REDIRECT --to-ports 3080
sudo iptables -t nat -D OUTPUT -p udp -d $PAGES_GAY_IPV4 --dport 443 -j REDIRECT --to-ports 3443
sudo ip6tables -t nat -D OUTPUT -p tcp -d $PAGES_GAY_IPV6 --dport 80 -j REDIRECT --to-ports 3080
sudo ip6tables -t nat -D OUTPUT -p tcp -d $PAGES_GAY_IPV6 --dport 443 -j REDIRECT --to-ports 3443
sudo ip6tables -t nat -D OUTPUT -p udp -d $PAGES_GAY_IPV6 --dport 80 -j REDIRECT --to-ports 3080
sudo ip6tables -t nat -D OUTPUT -p udp -d $PAGES_GAY_IPV6 --dport 443 -j REDIRECT --to-ports 3443
exit 0
fi
echo mapping requests to pages.gay to your local machine
sudo iptables -t nat -I OUTPUT -p tcp -d $PAGES_GAY_IPV4 --dport 80 -j REDIRECT --to-ports 3080
sudo iptables -t nat -I OUTPUT -p tcp -d $PAGES_GAY_IPV4 --dport 443 -j REDIRECT --to-ports 3443
sudo iptables -t nat -I OUTPUT -p udp -d $PAGES_GAY_IPV4 --dport 80 -j REDIRECT --to-ports 3080
sudo iptables -t nat -I OUTPUT -p udp -d $PAGES_GAY_IPV4 --dport 443 -j REDIRECT --to-ports 3443
sudo ip6tables -t nat -I OUTPUT -p tcp -d $PAGES_GAY_IPV6 --dport 80 -j REDIRECT --to-ports 3080
sudo ip6tables -t nat -I OUTPUT -p tcp -d $PAGES_GAY_IPV6 --dport 443 -j REDIRECT --to-ports 3443
sudo ip6tables -t nat -I OUTPUT -p udp -d $PAGES_GAY_IPV6 --dport 80 -j REDIRECT --to-ports 3080
sudo ip6tables -t nat -I OUTPUT -p udp -d $PAGES_GAY_IPV6 --dport 443 -j REDIRECT --to-ports 3443