-
Notifications
You must be signed in to change notification settings - Fork 201
165 lines (138 loc) · 4.58 KB
/
kernel-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Kernel Test
on:
pull_request:
paths:
- "**/*.go"
- "**/*.c"
- "**/*.h"
- "go.mod"
- "go.sum"
- ".github/workflows/kernel-test.yml"
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Set up Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
with:
go-version: 1.21.0
- name: Generate and build
run: |
git submodule update --init
make GOFLAGS="-buildvcs=false" CC=clang
- name: Store executable
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
with:
name: dae
path: dae
test:
runs-on: ubuntu-22.04
name: Test
needs: build
strategy:
fail-fast: false
matrix:
kernel: [ '5.10-v0.3', '5.15-v0.3', '6.3-main', 'bpf-next-20231030.012704' ]
timeout-minutes: 10
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Retrieve stored executable
uses: actions/download-artifact@v3
with:
name: dae
path: dae
- name: Provision LVH VMs
uses: cilium/little-vm-helper@908ab1ff8a596a03cd5221a1f8602dc44c3f906d # v0.0.12
with:
test-name: dae-test
image-version: ${{ matrix.kernel }}
host-mount: ./
dns-resolver: '1.1.1.1'
install-dependencies: 'true'
cmd: |
chmod +x /host/dae/dae
- name: Setup
uses: cilium/little-vm-helper@908ab1ff8a596a03cd5221a1f8602dc44c3f906d # v0.0.12
with:
provision: 'false'
cmd: |
set -ex
docker network create dae
docker run -td --name socks5 --privileged --network dae ubuntu:22.04 bash
docker run -td --name dae --privileged --network dae -v /host:/host ubuntu:22.04 bash
- name: Setup socks5 server
uses: cilium/little-vm-helper@908ab1ff8a596a03cd5221a1f8602dc44c3f906d # v0.0.12
with:
provision: 'false'
cmd: |
set -ex
docker exec socks5 apt update
docker exec socks5 apt install -y dante-server
cat > ./danted.conf <<!
logoutput: /var/log/danted.log
internal: 0.0.0.0 port = 1080
external: eth0
method: username none
user.privileged: root
user.notprivileged: nobody
client pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: connect disconnect error
}
socks pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: connect disconnect error
}
!
docker cp ./danted.conf socks5:/etc/danted.conf
docker exec socks5 danted -D
docker exec socks5 cat /var/log/danted.log
- name: Setup dae server
uses: cilium/little-vm-helper@908ab1ff8a596a03cd5221a1f8602dc44c3f906d # v0.0.12
with:
provision: 'false'
cmd: |
set -ex
docker exec dae apt update
docker exec dae apt install -y curl
cat > ./conf.dae <<!
global {
tproxy_port: 12345
log_level: trace
lan_interface: auto
wan_interface: auto
allow_insecure: false
auto_config_kernel_parameter: true
}
node {
local: 'socks5://socks5:1080'
}
group {
proxy {
policy: min_moving_avg
}
}
routing {
dip(1.1.1.1) -> proxy
fallback: direct
}
!
chmod 600 ./conf.dae
docker cp ./conf.dae dae:/etc/conf.dae
docker exec dae mount -t debugfs none /sys/kernel/debug/
docker exec dae mount bpffs -t bpf /sys/fs/bpf
docker exec dae /host/dae/dae run -c /etc/conf.dae &> dae.log &
sleep 20s
docker exec dae curl 1.1.1.1
docker exec dae curl 1.0.0.1
cat dae.log
- name: Check
uses: cilium/little-vm-helper@908ab1ff8a596a03cd5221a1f8602dc44c3f906d # v0.0.12
with:
provision: 'false'
cmd: |
set -ex
docker exec socks5 cat /var/log/danted.log
docker exec socks5 cat /var/log/danted.log 2>&1 | grep -q 1.1.1.1
docker exec socks5 cat /var/log/danted.log 2>&1 | grep 1.0.0.1 && false || true