fast-path node-up when tunnel already passes traffic

This commit is contained in:
Antigravity Agent
2026-10-03 09:40:48 -04:00
parent aff5683165
commit 94e1e94062
+8
View File
@@ -73,6 +73,13 @@ else
echo "cdp relay started ($PEER_IP:$CDP_PORT -> 127.0.0.1:$CDP_PORT)" echo "cdp relay started ($PEER_IP:$CDP_PORT -> 127.0.0.1:$CDP_PORT)"
fi fi
# fast path: if the tunnel already passes traffic, skip the handshake wait.
# (WireGuard handshakes go stale without traffic; waiting 20s every launch
# is the main reason chrome-box feels slow to start.)
EGRESS=$(nsexec curl -sk --max-time 5 'https://1.1.1.1/cdn-cgi/trace' 2>/dev/null | grep -oP '^ip=\K.*' || true)
if [ -n "$EGRESS" ]; then
echo "tunnel already up (egress=$EGRESS), skipping handshake wait"
else
# wait for handshake (first one can take ~10s) # wait for handshake (first one can take ~10s)
HS="" HS=""
for i in $(seq 1 10); do for i in $(seq 1 10); do
@@ -86,4 +93,5 @@ else
echo "handshake ok" echo "handshake ok"
fi fi
EGRESS=$(nsexec curl -sk --max-time 15 'https://1.1.1.1/cdn-cgi/trace' 2>/dev/null | grep -oP '^ip=\K.*' || true) EGRESS=$(nsexec curl -sk --max-time 15 'https://1.1.1.1/cdn-cgi/trace' 2>/dev/null | grep -oP '^ip=\K.*' || true)
fi
echo "node=$NODE netns=$NETNS ifaces=$WG/$VETH egress=${EGRESS:-unknown}" echo "node=$NODE netns=$NETNS ifaces=$WG/$VETH egress=${EGRESS:-unknown}"