Skip to content

Commit d9c6eb7

Browse files
authored
add test CI (#69)
1 parent 30d2697 commit d9c6eb7

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

.github/workflows/test.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Test
2+
on:
3+
push:
4+
branches:
5+
- '**'
6+
pull_request:
7+
branches:
8+
- '**'
9+
10+
jobs:
11+
test:
12+
name: Test wireproxy
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Setting up Go
17+
uses: actions/setup-go@v2
18+
with:
19+
go-version: 1.19
20+
- name: Install dependencies
21+
run: sudo apt install wireguard curl
22+
- name: Building wireproxy
23+
run: |
24+
git tag dev
25+
make
26+
- name: Generate test config
27+
run: ./test_config.sh
28+
- name: Start wireproxy
29+
run: ./wireproxy -c test.conf & sleep 1
30+
- name: Test socks5
31+
run: curl --proxy socks5://localhost:64423 http://zx2c4.com/ip | grep -q "demo.wireguard.com"
32+

test_config.sh

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
exec 3<>/dev/tcp/demo.wireguard.com/42912
4+
privatekey="$(wg genkey)"
5+
wg pubkey <<<"$privatekey" >&3
6+
IFS=: read -r status server_pubkey server_port internal_ip <&3
7+
[[ $status == OK ]]
8+
cat >test.conf <<EOL
9+
[Interface]
10+
Address = $internal_ip/32
11+
PrivateKey = $privatekey
12+
DNS = 8.8.8.8
13+
14+
[Peer]
15+
PublicKey = $server_pubkey
16+
Endpoint = demo.wireguard.com:$server_port
17+
18+
[Socks5]
19+
BindAddress = 127.0.0.1:64423
20+
EOL

0 commit comments

Comments
 (0)