-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (90 loc) · 2.77 KB
/
Copy pathirc2p.yml
File metadata and controls
93 lines (90 loc) · 2.77 KB
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
name: irc2p tunnel integration
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
irc2p:
runs-on: ubuntu-latest
timeout-minutes: 8
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Build daemon
shell: bash
run: go build -o "$RUNNER_TEMP/ivnpd" ./cmd/ivnpd
- name: Run real tunnel and IRC connection
shell: bash
run: |
set -euo pipefail
readonly run_dir="$RUNNER_TEMP/ivnp-irc2p"
mkdir -p -- "$run_dir"
curl --fail --location --silent --show-error --retry 3 --retry-all-errors \
--output "$run_dir/privatehosts.txt" \
https://raw.githubusercontent.com/i2p/i2p.i2p/master/installer/resources/hosts.txt
cat >"$run_dir/ivnp.conf" <<EOF
[router]
version = 0.9.70
[tunnel]
enabled = true
hops = 2
exploratory_inbound_target = 1
exploratory_outbound_target = 1
exploratory_pool_capacity = 2
client_inbound_target = 1
client_outbound_target = 1
client_pool_capacity = 2
build_pending_capacity = 13
lifetime = 10m
renew_before = 30s
maintenance_interval = 1s
[sam]
enabled = true
listen_host = 127.0.0.1
listen_port = 7656
[addressbook]
enabled = true
privatehosts_path = $run_dir/privatehosts.txt
subscriptions =
[log]
level = info
format = text
EOF
"$RUNNER_TEMP/ivnpd" -config "$run_dir/ivnp.conf" -webui=false >"$run_dir/ivnpd.log" 2>&1 &
daemon_pid=$!
cleanup() {
status=$?
trap - EXIT
kill "$daemon_pid" 2>/dev/null || true
wait "$daemon_pid" 2>/dev/null || true
if ((status != 0)); then
cat "$run_dir/ivnpd.log" >&2
fi
exit "$status"
}
trap cleanup EXIT
ready=false
for _ in {1..90}; do
if (exec 3<>/dev/tcp/127.0.0.1/7656) 2>/dev/null; then
exec 3>&-
ready=true
break
fi
if ! kill -0 "$daemon_pid" 2>/dev/null; then
printf 'ivnpd exited before SAM became ready\n' >&2
exit 1
fi
sleep 1
done
if [[ $ready != true ]]; then
printf 'SAM did not become ready\n' >&2
exit 1
fi
IVNP_IRC2P_INTEGRATION=1 IVNP_IRC2P_SAM=127.0.0.1:7656 \
go test ./cmd/toyirc -run '^TestIRC2PIntegration$' -count=1 -timeout=5m