aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/src/meshbay_node/config.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/config.py')
-rw-r--r--packages/meshbay-node/src/meshbay_node/config.py59
1 files changed, 38 insertions, 21 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/config.py b/packages/meshbay-node/src/meshbay_node/config.py
index a7a0785..f3752ea 100644
--- a/packages/meshbay-node/src/meshbay_node/config.py
+++ b/packages/meshbay-node/src/meshbay_node/config.py
@@ -26,28 +26,33 @@ url = "https://meshbay.org"
username = "myusername"
[node]
-port = 19000 # TCP+TLS (MNP v1)
-quic_port = 19010 # QUIC (MNP v2)
-http_port = 19001 # HTTP file API (public content)
-ui_port = 18000 # local web UI
+quic_port = 19010 # QUIC (MNP) — LAN, port-forwarded, hub-less direct access
+ui_port = 18000 # local admin UI (127.0.0.1 only)
-# Multiple groups — each with its own directory and ports
+# One-time codes. An invitation waits for someone to read their messages; an
+# operator pairing code is typed during the SSH session that printed it.
+invite_ttl_hours = 168 # 7 days
+pair_ttl_hours = 24
+
+# Browser and native clients reach this node over WebRTC DataChannel via hub
+# signaling — no inbound port to open. QUIC is the optional direct path.
+
+# Multiple groups — each with its own directory
[[groups]]
id = "" # set after joining
name = "My Media"
shared_dir = "/home/user/Media"
-port = 19000
quic_port = 19010
-http_port = 19001
[[groups]]
id = ""
name = "Public Archive"
shared_dir = "/home/user/Archive"
-port = 19002
quic_port = 19012
-http_port = 19003
-visibility = "public"
+visibility = "public" # discoverable on the hub
+# join_policy = "open" # anyone the hub says is a member gets the group key,
+ # with no pairing code. Only for groups where that is
+ # genuinely intended: it means the hub can join too.
[keystore]
# unlock_file = "~/.config/meshbay/unlock.key"
@@ -68,10 +73,13 @@ class HubConfig:
@dataclass
class NodeConfig:
- port: int = 19000
quic_port: int = 19010
- http_port: int = 19001
ui_port: int = 18000
+ # How long a one-time code stays usable. Invitations travel through a human
+ # conversation and are answered days later; operator pairing happens during
+ # the SSH session that printed it.
+ invite_ttl_hours: int = 168 # 7 days
+ pair_ttl_hours: int = 24
@dataclass
@@ -79,10 +87,16 @@ class GroupConfig:
id: str = ""
name: str = ""
shared_dir: str = ""
- visibility: str = "private" # public|private
- port: int = 19000 # TCP+TLS MNP port for this group
+ visibility: str = "private" # public|private — discoverability, not admission
+ # Admission. "invite" (default) means a newcomer needs a one-time pairing code
+ # before the node wraps the group key for them; "open" means the node pins
+ # whoever turns up first (TOFU) and serves them.
+ #
+ # Deliberately read from THIS file and never from the hub: a hub that could
+ # declare a group open would walk into any group it liked. Being findable
+ # (`visibility`) and being open (`join_policy`) are different questions.
+ join_policy: str = "invite" # invite|open
quic_port: int = 19010 # QUIC MNP port
- http_port: int = 19001 # HTTP file API port
@dataclass
@@ -121,10 +135,14 @@ def load_config(path: Path = DEFAULT_CONFIG_PATH) -> Config:
cfg.hub.username = hub.get("username", cfg.hub.username)
nd = raw.get("node", {})
- cfg.node.port = nd.get("port", cfg.node.port)
+ # `port` (TCP+TLS) and `http_port` no longer exist — both listeners were removed
+ # in Phase 11.5 (findings C1, C6). Regenerate node.toml with `meshbay-node init`.
cfg.node.quic_port = nd.get("quic_port", cfg.node.quic_port)
- cfg.node.http_port = nd.get("http_port", cfg.node.http_port)
cfg.node.ui_port = nd.get("ui_port", cfg.node.ui_port)
+ cfg.node.invite_ttl_hours = int(
+ nd.get("invite_ttl_hours", cfg.node.invite_ttl_hours))
+ cfg.node.pair_ttl_hours = int(
+ nd.get("pair_ttl_hours", cfg.node.pair_ttl_hours))
# Multi-group: [[groups]] array
if "groups" in raw:
@@ -134,9 +152,8 @@ def load_config(path: Path = DEFAULT_CONFIG_PATH) -> Config:
name=g.get("name", ""),
shared_dir=g.get("shared_dir", ""),
visibility=g.get("visibility", "private"),
- port=g.get("port", cfg.node.port),
+ join_policy=g.get("join_policy", "invite"),
quic_port=g.get("quic_port", cfg.node.quic_port),
- http_port=g.get("http_port", cfg.node.http_port),
))
# Back-compat: single [group] section
elif "group" in raw:
@@ -163,8 +180,8 @@ def load_config(path: Path = DEFAULT_CONFIG_PATH) -> Config:
cfg.hub.url = url
if user := os.environ.get("MESHBAY_USERNAME"):
cfg.hub.username = user
- if port := os.environ.get("MESHBAY_PORT"):
- cfg.node.port = int(port)
+ if port := os.environ.get("MESHBAY_QUIC_PORT"):
+ cfg.node.quic_port = int(port)
return cfg