diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..6c46d20 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,32 @@ +name: Test +on: + push: + branches: + - '**' + pull_request: + branches: + - '**' + +jobs: + test: + name: Test wireproxy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setting up Go + uses: actions/setup-go@v2 + with: + go-version: 1.19 + - name: Install dependencies + run: sudo apt install wireguard curl + - name: Building wireproxy + run: | + git tag dev + make + - name: Generate test config + run: ./test_config.sh + - name: Start wireproxy + run: ./wireproxy -c test.conf & sleep 1 + - name: Test socks5 + run: curl --proxy socks5://localhost:64423 http://zx2c4.com/ip | grep -q "demo.wireguard.com" + diff --git a/test_config.sh b/test_config.sh new file mode 100755 index 0000000..3f439cd --- /dev/null +++ b/test_config.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -e +exec 3<>/dev/tcp/demo.wireguard.com/42912 +privatekey="$(wg genkey)" +wg pubkey <<<"$privatekey" >&3 +IFS=: read -r status server_pubkey server_port internal_ip <&3 +[[ $status == OK ]] +cat >test.conf <