2021-07-13 13:59:59 +08:00
|
|
|
#!/bin/bash
|
|
|
|
set -xe
|
|
|
|
|
2021-07-27 07:43:26 +08:00
|
|
|
sudo apt update
|
2022-02-06 07:40:44 +08:00
|
|
|
sudo apt install -y curl wireguard python3
|
|
|
|
|
|
|
|
. /etc/os-release
|
|
|
|
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
|
|
|
|
curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key" | sudo apt-key add -
|
|
|
|
sudo apt update
|
|
|
|
sudo apt install -y podman
|
2021-07-13 13:59:59 +08:00
|
|
|
|
2021-07-17 19:51:29 +08:00
|
|
|
mkdir -p local
|
2021-07-31 02:32:08 +08:00
|
|
|
mkdir -p local/tunnel
|
2021-07-17 19:51:29 +08:00
|
|
|
|
2021-07-13 13:59:59 +08:00
|
|
|
mkdir -p bin
|
|
|
|
cd bin
|
|
|
|
|
2021-07-30 23:57:24 +08:00
|
|
|
curl -vL https://github.com/wangyu-/udp2raw-tunnel/releases/download/20200818.0/udp2raw_binaries.tar.gz -o udp2raw.tgz
|
2021-07-13 13:59:59 +08:00
|
|
|
tar -xvzf udp2raw.tgz udp2raw_amd64
|
2021-07-13 15:16:10 +08:00
|
|
|
chmod +x udp2raw_amd64
|
2021-07-13 13:59:59 +08:00
|
|
|
rm udp2raw.tgz
|
2021-07-16 15:19:56 +08:00
|
|
|
|
|
|
|
curl -vL https://github.com/wangyu-/UDPspeeder/releases/download/20210116.0/speederv2_binaries.tar.gz -o udpspeeder.tgz
|
|
|
|
tar -xvzf udpspeeder.tgz speederv2_amd64
|
|
|
|
chmod +x speederv2_amd64
|
|
|
|
rm udpspeeder.tgz
|
|
|
|
|
2022-01-29 18:19:46 +08:00
|
|
|
curl -vL https://github.com/ginuerzh/gost/releases/download/v2.11.1/gost-linux-amd64-2.11.1.gz -o gost.gz
|
2022-02-06 07:40:44 +08:00
|
|
|
gzip -cd gost.gz > gost
|
2022-01-29 18:19:46 +08:00
|
|
|
chmod +x gost
|
2022-02-06 07:40:44 +08:00
|
|
|
rm gost.gz
|
2022-01-29 18:19:46 +08:00
|
|
|
|
2021-07-13 13:59:59 +08:00
|
|
|
cd ..
|
|
|
|
|
2021-07-31 02:51:31 +08:00
|
|
|
VERIFIED_TUNNEL_HASH="a7ce38b2c30980be4e71c3af8a9c1db8183db349c699fa6f843e67add7e6cca2"
|
|
|
|
LOCAL_TUNNEL_HASH=$(sha256sum bin/udp2raw_amd64 | awk '{print $1}')
|
|
|
|
|
|
|
|
VERIFIED_SPEEDER_HASH="3cf8f6c1e9baa530170368efb8a4bfcd6e75f88c2726ecbf2a75261dd1dd9fd5"
|
|
|
|
LOCAL_SPEEDER_HASH=$(sha256sum bin/speederv2_amd64 | awk '{print $1}')
|
|
|
|
|
2022-01-29 18:19:46 +08:00
|
|
|
VERIFIED_GOST_HASH="5434f730594d29b933087dcaf1ae680bee7077abd021c004f28287deccfe49b5"
|
2022-01-29 18:21:20 +08:00
|
|
|
LOCAL_GOST_HASH=$(sha256sum bin/gost | awk '{print $1}')
|
2022-01-29 18:19:46 +08:00
|
|
|
|
2021-07-31 02:51:31 +08:00
|
|
|
if [ "$LOCAL_TUNNEL_HASH" == "$VERIFIED_TUNNEL_HASH" ]
|
2021-07-13 13:59:59 +08:00
|
|
|
then
|
2021-07-31 02:51:31 +08:00
|
|
|
echo "[OK] udp2raw hash match: $LOCAL_TUNNEL_HASH"
|
2021-07-13 13:59:59 +08:00
|
|
|
else
|
2021-07-31 02:51:31 +08:00
|
|
|
echo "[WARN] udp2raw hash mismatch: $LOCAL_TUNNEL_HASH. Expected: $VERIFIED_TUNNEL_HASH"
|
2021-07-13 13:59:59 +08:00
|
|
|
fi
|
2021-07-16 15:19:56 +08:00
|
|
|
|
2021-07-31 02:51:31 +08:00
|
|
|
if [ "$LOCAL_SPEEDER_HASH" == "$VERIFIED_SPEEDER_HASH" ]
|
2021-07-16 15:19:56 +08:00
|
|
|
then
|
2021-07-31 02:51:31 +08:00
|
|
|
echo "[OK] speederv2 hash match: $LOCAL_SPEEDER_HASH"
|
2021-07-16 15:19:56 +08:00
|
|
|
else
|
2021-07-31 02:51:31 +08:00
|
|
|
echo "[WARN] speederv2 hash mismatch: $LOCAL_SPEEDER_HASH. Expected: $VERIFIED_SPEEDER_HASH"
|
2021-07-16 15:19:56 +08:00
|
|
|
fi
|
2022-01-29 18:19:46 +08:00
|
|
|
|
|
|
|
if [ "$LOCAL_GOST_HASH" == "$VERIFIED_GOST_HASH" ]
|
|
|
|
then
|
|
|
|
echo "[OK] gost hash match: $LOCAL_GOST_HASH"
|
|
|
|
else
|
|
|
|
echo "[WARN] gost hash mismatch: $LOCAL_GOST_HASH. Expected: $VERIFIED_GOST_HASH"
|
|
|
|
fi
|
2022-02-06 07:40:44 +08:00
|
|
|
|
2022-02-06 07:50:54 +08:00
|
|
|
podman build . -f DockerfileBase -t wg-ops-base:latest
|
|
|
|
podman build . -f DockerfileBuildEnv -t wg-ops-buildenv:latest
|
|
|
|
podman build . -f DockerfileRunEnv -t wg-ops-runenv:latest
|
2022-02-06 07:40:44 +08:00
|
|
|
|
2022-02-06 07:59:25 +08:00
|
|
|
podman save wg-ops-runenv:latest | sudo podman load
|
|
|
|
|
2022-02-06 07:40:44 +08:00
|
|
|
CONTAINER_ID=$(podman run --rm -it -v ./bin:/root/bin -d wg-ops-buildenv)
|
|
|
|
podman cp mux.c $CONTAINER_ID:/root/
|
|
|
|
podman exec -it $CONTAINER_ID bash -c "cd /root && gcc -O3 -o bin/mux mux.c"
|
|
|
|
podman stop $CONTAINER_ID
|