summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/src/meshbay_node/ops.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/ops.py')
-rw-r--r--packages/meshbay-node/src/meshbay_node/ops.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/ops.py b/packages/meshbay-node/src/meshbay_node/ops.py
index 2ab6753..07579cd 100644
--- a/packages/meshbay-node/src/meshbay_node/ops.py
+++ b/packages/meshbay-node/src/meshbay_node/ops.py
@@ -341,6 +341,7 @@ async def list_groups(state: dict) -> dict:
"max_concurrent_streams": nd.max_concurrent_streams if nd else 8,
"transcode_incompatible_video": nd.transcode_incompatible_video if nd else True,
"stun_servers": nd.stun_servers if nd and nd.stun_servers else list(DEFAULT_STUN_SERVERS),
+ "ice_interfaces": nd.ice_interfaces if nd else [],
}
if roster:
settings = await roster.node_settings(defaults)
@@ -799,6 +800,7 @@ async def get_node_settings(state: dict) -> dict:
"max_concurrent_streams": nd.max_concurrent_streams,
"transcode_incompatible_video": nd.transcode_incompatible_video,
"stun_servers": nd.stun_servers if nd.stun_servers else list(DEFAULT_STUN_SERVERS),
+ "ice_interfaces": nd.ice_interfaces,
}
if roster:
return await roster.node_settings(defaults)
@@ -817,7 +819,8 @@ async def set_node_settings(state: dict, settings: dict) -> dict:
"device_request_ttl_minutes": ("int", roster.SETTING_DEVICE_TTL),
"max_concurrent_streams": ("int", roster.SETTING_MAX_STREAMS),
"transcode_incompatible_video": ("bool", roster.SETTING_TRANSCODE),
- "stun_servers": ("list", roster.SETTING_STUN_SERVERS),
+ "stun_servers": ("stun_list", roster.SETTING_STUN_SERVERS),
+ "ice_interfaces": ("list", roster.SETTING_ICE_INTERFACES),
}
set_by = state.get("node_user_id", "")
@@ -841,14 +844,15 @@ async def set_node_settings(state: dict, settings: dict) -> dict:
setattr(nd, key, v)
await roster.set_node_setting(setting_key, "1" if v else "0", set_by)
updated[key] = v
- elif kind == "list":
+ elif kind in ("list", "stun_list"):
import json as _json
if not isinstance(value, list):
raise OpError(f"{key} must be a list")
v = [str(s) for s in value]
- for s in v:
- if not s.startswith("stun:"):
- raise OpError(f"Invalid STUN server: {s} (must start with stun:)")
+ if kind == "stun_list":
+ for s in v:
+ if not s.startswith("stun:"):
+ raise OpError(f"Invalid STUN server: {s} (must start with stun:)")
setattr(nd, key, v)
await roster.set_node_setting(setting_key, _json.dumps(v), set_by)
updated[key] = v
@@ -863,6 +867,9 @@ async def set_node_settings(state: dict, settings: dict) -> dict:
webrtc = state.get("webrtc")
if webrtc and hasattr(webrtc, '_stun'):
webrtc._stun = updated["stun_servers"]
+ if "ice_interfaces" in updated:
+ from meshbay_node.transport.ice_filter import install as install_ice_filter
+ install_ice_filter(updated["ice_interfaces"] or None)
log.info("Node settings updated: %s", updated)
return {"updated": updated}