fix(server): emit correct CIDR prefix in rtc.ips.includes (IPv4 /32, IPv6 /128) #37
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/render-livekit-yaml-ipv4-cidr"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #36.
Summary
render_livekit_yamlhardcoded/128in thertc.ips.includesline, which is the right prefix for IPv6 single-host (mycelium multi-user deploys) but invalid CIDR for IPv4 — Pion rejects the config and livekit-server crashes on startup withinvalid CIDR address: <IPV4>/128.Detect the address family via
IpAddr::parse():/32/128(unchanged)Test plan
invalid CIDRcrash; after patch — yaml renders185.206.122.48/32, livekit-server binds UDP :7882 + TCP :7881 + TCP :7880 cleanly, signaling reachable through nginx, browser huddle works end-to-end.4a0:6976:8fa7:efc:5::1): yaml renders4a0:6976:8fa7:efc:5::1/128— identical to pre-patch behavior. No regression. livekit-server bound on the per-user ports.cargo build -p hero_livekit_serverclean (no new warnings)Compatibility
/128after a hostname (also invalid); now skip the block. This is a behavioral change but the previous behavior was already broken.`render_livekit_yaml` hardcoded `/128` in the `rtc.ips.includes` line, which is the right prefix for IPv6 single-host (mycelium multi-user deploys) but invalid CIDR for IPv4 — Pion (livekit-server's UDP layer) rejects the config and the daemon crashes on startup with: invalid CIDR address: <IPV4>/128 Reproduced on a single-user TF Grid VM where node_ip is a public IPv4 (e.g. `185.206.122.48`). The supervisor wrote the config but livekit-server failed to bind RTC ports — no signaling, no media. Detect the address family at config-render time: - IPv4 literal → emit `/32` - IPv6 literal → emit `/128` (unchanged for the multi-user path) - Hostname / non-literal → skip the include block entirely. Pion's CIDR parser rejects anything that isn't an IP literal, and binding on all global IPs is the safe default on single-user hosts where there's no sibling-user collision to worry about. The multi-user mycelium path remains identical: node_ip there is always an IPv6 literal, so /128 is still the prefix that gets emitted.