aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/tests/test_quic_enabled.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-09-01 18:56:01 +0200
committerChristophe Besson <cbesson@gmail.com>2026-09-01 18:56:01 +0200
commit9f7698340e5148f8f247fe0d70a57f7f37f1f72d (patch)
tree33a751788fc8c877eb97be2cea7782800f3383af /packages/meshbay-node/tests/test_quic_enabled.py
parent73a119cbc7641b5f0005d0ce8bc4c7b0b7ae6a6e (diff)
downloadmeshbay-9f7698340e5148f8f247fe0d70a57f7f37f1f72d.tar.gz
feat(node): [node] quic_enabled flag, off by default
The QUIC MNP listener was started unconditionally whenever aioquic was importable — but nothing speaks QUIC: the browser and desktop clients use WebRTC, QuicChunkClient has no production caller, and the hub-less `group://` sidecar (D9) is unbuilt. So on every node it was an open UDP port with no client and no working NAT traversal (`punch_nat()` is a direct-connection helper, not a traversal stack). daemon startup now gates QuicChunkServer on `self._config.node.quic_enabled` (default False; `MESHBAY_QUIC_ENABLED` overrides). The generated node.toml templates (config.py, the CLI, the desktop client) carry the line, commented for what it is. Removes the exposure the third review's M2 lives on until a QUIC client exists; the parity fix for the handlers themselves is the next commit. Third security review, finding M2 (mitigation). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011pG75yGK3NthNfyjH74omG
Diffstat (limited to 'packages/meshbay-node/tests/test_quic_enabled.py')
-rw-r--r--packages/meshbay-node/tests/test_quic_enabled.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/packages/meshbay-node/tests/test_quic_enabled.py b/packages/meshbay-node/tests/test_quic_enabled.py
new file mode 100644
index 0000000..c0c1568
--- /dev/null
+++ b/packages/meshbay-node/tests/test_quic_enabled.py
@@ -0,0 +1,53 @@
+"""
+The QUIC MNP listener is off unless the operator turns it on.
+
+No shipping client speaks QUIC (browser and desktop use WebRTC; the hub-less
+`group://` sidecar is unbuilt), so a node that started it by default would only
+be exposing a UDP port. `daemon.py` gates `QuicChunkServer` on
+`self._config.node.quic_enabled`; these follow the value down the config path.
+"""
+
+import textwrap
+from pathlib import Path
+
+from meshbay_node.config import load_config
+
+
+def _cfg(tmp_path: Path, body: str):
+ p = tmp_path / "node.toml"
+ p.write_text(textwrap.dedent(body))
+ return load_config(p)
+
+
+def test_off_by_default(tmp_path):
+ cfg = _cfg(tmp_path, """
+ [node]
+ quic_port = 19010
+ """)
+ assert cfg.node.quic_enabled is False
+
+
+def test_the_operator_turns_it_on(tmp_path):
+ cfg = _cfg(tmp_path, """
+ [node]
+ quic_enabled = true
+ """)
+ assert cfg.node.quic_enabled is True
+
+
+def test_the_environment_can_force_it_on(tmp_path, monkeypatch):
+ monkeypatch.setenv("MESHBAY_QUIC_ENABLED", "1")
+ cfg = _cfg(tmp_path, """
+ [node]
+ quic_enabled = false
+ """)
+ assert cfg.node.quic_enabled is True
+
+
+def test_the_environment_can_force_it_off(tmp_path, monkeypatch):
+ monkeypatch.setenv("MESHBAY_QUIC_ENABLED", "false")
+ cfg = _cfg(tmp_path, """
+ [node]
+ quic_enabled = true
+ """)
+ assert cfg.node.quic_enabled is False