Skip to content

IRC2P live canary

IRC2P live canary #2

Workflow file for this run

name: IRC2P live canary
on:
schedule:
- cron: "17 3 * * *"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: irc2p-live-canary
cancel-in-progress: true
jobs:
live:
runs-on: ubuntu-latest
timeout-minutes: 12
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Build daemon
run: go build -o "$RUNNER_TEMP/ivnpd" ./cmd/ivnpd
- name: Run live tunnel and IRC canary
shell: bash
run: |
set -euo pipefail
readonly run_dir="$RUNNER_TEMP/ivnp-irc2p"
readonly status_url="http://127.0.0.1:7070/api/status"
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=true -webui-listen=127.0.0.1:7070 >"$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
tunnel_ready=false
last_status='{}'
for _ in {1..240}; do
if last_status=$(curl --fail --silent --show-error --max-time 2 "$status_url" 2>/dev/null); then
if jq -e '
.readiness.exploratory_inbound_tunnels > 0 and
.readiness.exploratory_outbound_tunnels > 0
' <<<"$last_status" >/dev/null; then
tunnel_ready=true
break
fi
fi
if ! kill -0 "$daemon_pid" 2>/dev/null; then
printf 'ivnpd exited before an exploratory tunnel pair became active\n' >&2
exit 1
fi
sleep 1
done
if [[ $tunnel_ready != true ]]; then
printf 'exploratory tunnel pair did not become active; last status: %s\n' "$last_status" >&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