diff --git a/.github/workflows/build-sha.yml b/.github/workflows/build-sha.yml index 4de1c260..91872cb4 100644 --- a/.github/workflows/build-sha.yml +++ b/.github/workflows/build-sha.yml @@ -40,46 +40,52 @@ jobs: run: rm target/* - name: Rebuild target branch run: | - echo 'iptables -t nat -A POSTROUTING -o wgcf -j MASQUERADE || true' >> target/wgcf-up.sh - echo 'ip6tables -t nat -A POSTROUTING -o wgcf -j MASQUERADE || true' >> target/wgcf-up.sh - echo 'iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE || true' >> target/wgcf-up.sh - echo 'ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE || true' >> target/wgcf-up.sh - echo 'ip route add 162.159.192.0/24 dev eth0 via 10.11.0.1 || true' >> target/wgcf-up.sh - echo 'ip route add 162.159.193.0/24 dev eth0 via 10.11.0.1 || true' >> target/wgcf-up.sh - echo 'ip route add 162.159.195.0/24 dev eth0 via 10.11.0.1 || true' >> target/wgcf-up.sh - echo 'ip route add 162.159.204.0/24 dev eth0 via 10.11.0.1 || true' >> target/wgcf-up.sh - echo 'ip route add 188.114.96.0/22 dev eth0 via 10.11.0.1 || true' >> target/wgcf-up.sh - echo 'ip route add 2606:4700:d0::/47 dev eth0 via fe80::6a77:24ff:fed6:809d || true' >> target/wgcf-up.sh - echo 'ip route add 1.1.1.1/32 dev wgcf || true' >> target/wgcf-up.sh - echo 'ip route add 2606:4700:4700::1111/128 dev wgcf || true' >> target/wgcf-up.sh - echo 'ip route add 0.0.0.0/1 dev wgcf || true' >> target/wgcf-up.sh - echo 'ip route add 128.0.0.0/1 dev wgcf || true' >> target/wgcf-up.sh - echo 'ip route add ::/1 dev wgcf || true' >> target/wgcf-up.sh - echo 'ip route add 8000::/1 dev wgcf || true' >> target/wgcf-up.sh - ./netgen.py ref1/china4.txt -o target/wgcf-up.sh -p 'ip route add ' -s ' dev eth0 via 10.11.0.1 || true' - ./netgen.py ref1/china6.txt -o target/wgcf-up.sh -p 'ip route add ' -s ' dev eth0 via fe80::6a77:24ff:fed6:809d || true' - ./netgen.py private4.txt -o target/wgcf-up.sh -p 'ip route add ' -s ' dev eth0 via 10.11.0.1 || true' - ./netgen.py private6.txt -o target/wgcf-up.sh -p 'ip route add ' -s ' dev eth0 via fe80::6a77:24ff:fed6:809d || true' - echo 'iptables -t nat -D POSTROUTING -o wgcf -j MASQUERADE || true' >> target/wgcf-down.sh - echo 'ip6tables -t nat -D POSTROUTING -o wgcf -j MASQUERADE || true' >> target/wgcf-down.sh - echo 'iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE || true' >> target/wgcf-down.sh - echo 'ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE || true' >> target/wgcf-down.sh - echo 'ip route del 162.159.192.0/24 dev eth0 via 10.11.0.1 || true' >> target/wgcf-down.sh - echo 'ip route del 162.159.193.0/24 dev eth0 via 10.11.0.1 || true' >> target/wgcf-down.sh - echo 'ip route del 162.159.195.0/24 dev eth0 via 10.11.0.1 || true' >> target/wgcf-down.sh - echo 'ip route del 162.159.204.0/24 dev eth0 via 10.11.0.1 || true' >> target/wgcf-down.sh - echo 'ip route del 188.114.96.0/22 dev eth0 via 10.11.0.1 || true' >> target/wgcf-down.sh - echo 'ip route del 2606:4700:d0::/47 dev eth0 via fe80::6a77:24ff:fed6:809d || true' >> target/wgcf-down.sh - echo 'ip route del 1.1.1.1/32 dev wgcf || true' >> target/wgcf-down.sh - echo 'ip route del 2606:4700:4700::1111/128 dev wgcf || true' >> target/wgcf-down.sh - echo 'ip route del 0.0.0.0/1 dev wgcf || true' >> target/wgcf-down.sh - echo 'ip route del 128.0.0.0/1 dev wgcf || true' >> target/wgcf-down.sh - echo 'ip route del ::/1 dev wgcf || true' >> target/wgcf-down.sh - echo 'ip route del 8000::/1 dev wgcf || true' >> target/wgcf-down.sh - ./netgen.py ref1/china4.txt -o target/wgcf-down.sh -p 'ip route del ' -s ' dev eth0 via 10.11.0.1 || true' - ./netgen.py ref1/china6.txt -o target/wgcf-down.sh -p 'ip route del ' -s ' dev eth0 via fe80::6a77:24ff:fed6:809d || true' - ./netgen.py private4.txt -o target/wgcf-down.sh -p 'ip route del ' -s ' dev eth0 via 10.11.0.1 || true' - ./netgen.py private6.txt -o target/wgcf-down.sh -p 'ip route del ' -s ' dev eth0 via fe80::6a77:24ff:fed6:809d || true' + WARP_DEV="wgcf" + GW_DEV="eth0" + GW_V4="10.11.0.1" + GW_V6="fe80::6a77:24ff:fed6:809d" + UP_SCRIPT="wgcf-up.sh" + DOWN_SCRIPT="wgcf-down.sh" + echo "iptables -t nat -A POSTROUTING -o $WARP_DEV -j MASQUERADE || true" >> target/$UP_SCRIPT + echo "ip6tables -t nat -A POSTROUTING -o $WARP_DEV -j MASQUERADE || true" >> target/$UP_SCRIPT + echo "iptables -t nat -A POSTROUTING -o $GW_DEV -j MASQUERADE || true" >> target/$UP_SCRIPT + echo "ip6tables -t nat -A POSTROUTING -o $GW_DEV -j MASQUERADE || true" >> target/$UP_SCRIPT + echo "ip route add 162.159.192.0/24 dev $GW_DEV via $GW_V4 || true" >> target/$UP_SCRIPT + echo "ip route add 162.159.193.0/24 dev $GW_DEV via $GW_V4 || true" >> target/$UP_SCRIPT + echo "ip route add 162.159.195.0/24 dev $GW_DEV via $GW_V4 || true" >> target/$UP_SCRIPT + echo "ip route add 162.159.204.0/24 dev $GW_DEV via $GW_V4 || true" >> target/$UP_SCRIPT + echo "ip route add 188.114.96.0/22 dev $GW_DEV via $GW_V4 || true" >> target/$UP_SCRIPT + echo "ip route add 2606:4700:d0::/47 dev $GW_DEV via $GW_V6 || true" >> target/$UP_SCRIPT + ./netgen.py ref1/china4.txt -o target/$UP_SCRIPT -p "ip route add " -s " dev $GW_DEV via $GW_V4 || true" + ./netgen.py ref1/china6.txt -o target/$UP_SCRIPT -p "ip route add " -s " dev $GW_DEV via $GW_V6 || true" + ./netgen.py private4.txt -o target/$UP_SCRIPT -p "ip route add " -s " dev $GW_DEV via $GW_V4 || true" + ./netgen.py private6.txt -o target/$UP_SCRIPT -p "ip route add " -s " dev $GW_DEV via $GW_V6 || true" + echo "ip route add 1.1.1.1/32 dev $WARP_DEV || true" >> target/$UP_SCRIPT + echo "ip route add 2606:4700:4700::1111/128 dev $WARP_DEV || true" >> target/$UP_SCRIPT + echo "ip route add 0.0.0.0/1 dev $WARP_DEV || true" >> target/$UP_SCRIPT + echo "ip route add 128.0.0.0/1 dev $WARP_DEV || true" >> target/$UP_SCRIPT + echo "ip route add ::/1 dev $WARP_DEV || true" >> target/$UP_SCRIPT + echo "ip route add 8000::/1 dev $WARP_DEV || true" >> target/$UP_SCRIPT + echo "iptables -t nat -D POSTROUTING -o $WARP_DEV -j MASQUERADE || true" >> target/$DOWN_SCRIPT + echo "ip6tables -t nat -D POSTROUTING -o $WARP_DEV -j MASQUERADE || true" >> target/$DOWN_SCRIPT + echo "iptables -t nat -D POSTROUTING -o $GW_DEV -j MASQUERADE || true" >> target/$DOWN_SCRIPT + echo "ip6tables -t nat -D POSTROUTING -o $GW_DEV -j MASQUERADE || true" >> target/$DOWN_SCRIPT + echo "ip route del 162.159.192.0/24 dev $GW_DEV via $GW_V4 || true" >> target/$DOWN_SCRIPT + echo "ip route del 162.159.193.0/24 dev $GW_DEV via $GW_V4 || true" >> target/$DOWN_SCRIPT + echo "ip route del 162.159.195.0/24 dev $GW_DEV via $GW_V4 || true" >> target/$DOWN_SCRIPT + echo "ip route del 162.159.204.0/24 dev $GW_DEV via $GW_V4 || true" >> target/$DOWN_SCRIPT + echo "ip route del 188.114.96.0/22 dev $GW_DEV via $GW_V4 || true" >> target/$DOWN_SCRIPT + echo "ip route del 2606:4700:d0::/47 dev $GW_DEV via $GW_V6 || true" >> target/$DOWN_SCRIPT + ./netgen.py ref1/china4.txt -o target/$DOWN_SCRIPT -p "ip route del " -s " dev $GW_DEV via $GW_V4 || true" + ./netgen.py ref1/china6.txt -o target/$DOWN_SCRIPT -p "ip route del " -s " dev $GW_DEV via $GW_V6 || true" + ./netgen.py private4.txt -o target/$DOWN_SCRIPT -p "ip route del " -s " dev $GW_DEV via $GW_V4 || true" + ./netgen.py private6.txt -o target/$DOWN_SCRIPT -p "ip route del " -s " dev $GW_DEV via $GW_V6 || true" + echo "ip route del 1.1.1.1/32 dev $WARP_DEV || true" >> target/$DOWN_SCRIPT + echo "ip route del 2606:4700:4700::1111/128 dev $WARP_DEV || true" >> target/$DOWN_SCRIPT + echo "ip route del 0.0.0.0/1 dev $WARP_DEV || true" >> target/$DOWN_SCRIPT + echo "ip route del 128.0.0.0/1 dev $WARP_DEV || true" >> target/$DOWN_SCRIPT + echo "ip route del ::/1 dev $WARP_DEV || true" >> target/$DOWN_SCRIPT + echo "ip route del 8000::/1 dev $WARP_DEV || true" >> target/$DOWN_SCRIPT cp wg-watch.sh target/ cd target chmod +x *.sh