You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(connect): survive WS port conflicts + clearer firewall guidance (#61)
Address operator review of the connect one-liner install:
- WS bind failure is no longer fatal: bind the listener eagerly and, on
failure (e.g. :8081 already in use), log a warning and run without the
sink, so a taken port can't crash-loop the container and tear down the
DoubleZero tunnel (src/main.rs, src/sinks/ws.rs — bind/serve split).
- Installer WS port preflight: detect an already-bound WS port and offer
to pick another port, disable the sink, or continue (scripts/connect*.sh).
- WS_BIND="" now works through the one-liner (forwarded even when empty),
so the WS sink can be disabled without a hand-written docker run.
- Firewall guidance for default-deny-incoming hosts: admit the decapsulated
inner multicast on the tunnel interface (ufw allow in on doublezero1),
since allowing GRE alone isn't enough.
Docs + CHANGELOG updated.
warn "firewalld is running: ensure GRE (protocol 47) and UDP $LIVENESS_UDP_PORT are allowed."
394
+
warn "firewalld is running: allow GRE (protocol 47) and UDP $LIVENESS_UDP_PORT. If your default zone denies incoming, also place the tunnel interface in a trusted zone once it exists:
ws_disabled &&return 0 # sink off -> nothing to bind
428
+
local p; p="$(ws_port)"
429
+
case"$p"in*[!0-9]*|'') return 0;; esac# not a plain numeric port -> let the bridge validate WS_BIND
430
+
port_in_use "$p";local rc=$?
431
+
if [ "$rc"-eq 2 ];then
432
+
warn "Can't check whether TCP port $p is free (no ss/netstat installed); if it's in use the WS sink won't bind (the tunnel is unaffected)."
433
+
return 0
434
+
fi
435
+
[ "$rc"-ne 0 ] &&return 0 # free
436
+
# In use — name the holder when ss can show it.
437
+
local who=""
438
+
command -v ss >/dev/null 2>&1&& who="$($SUDO ss -Hltnp 2>/dev/null | awk -v p=":${p}\$"'$4 ~ p {print $NF; exit}')"
439
+
warn "TCP port $p is already in use${who:+ ($who)}; the WS market-data sink can't bind there."
440
+
if [ -r"$TTY" ] && [ "$DZ_ASSUME_YES"!= 1 ];then
441
+
local choice; choice="$(ask 'WS port in use — [p]ick another port, [d]isable the WS sink, or [c]ontinue anyway''c')"
442
+
case"$choice"in
443
+
p|P) local np; np="$(ask 'New WS port''8181')"; WS_BIND="0.0.0.0:${np}"; WS_PORT="$np"
444
+
info "WS sink will use 0.0.0.0:${np}."; preflight_ws_port ;; # re-check the new choice
445
+
d|D) WS_BIND=""; info "WS sink disabled (WS_BIND=\"\")." ;;
446
+
*) warn "Continuing; the bridge starts without the WS sink (the tunnel is unaffected)." ;;
447
+
esac
448
+
else
449
+
warn "Continuing non-interactively; the bridge starts without the WS sink (the tunnel is unaffected). Re-run with WS_BIND=<host>:<free-port> to serve it, or WS_BIND=\"\" to disable it explicitly."
# user onchain for $DZ_ENV. If this errors with an access-pass message, that
484
553
# provisioning step still needs to happen. Once the tunnel is up, the bridge
485
554
# self-heals onto the doublezero1 interface within ~30s and quotes begin flowing.
486
-
$SUDO docker exec$EXEC_TTY"$DZ_NAME" doublezero connect multicast || warn "connect failed (often: no access pass for this IP, or provider firewall/NAT). See notes above."
555
+
$SUDO docker exec$EXEC_TTY"$DZ_NAME" doublezero connect multicast || warn "connect failed (often: no access pass for this IP; provider firewall/NAT; or a default-deny host firewall dropping the decapsulated inner multicast on doublezero1). See the firewall notes above."
0 commit comments