Implement --ice-servers feature flag - #16
Conversation
|
Not reviewing the draft, just saving you a debugging round:
|
|
Oh my bad, I will fix that. That simplifies the PR. |
Rebase feature branch onto main.
The PR incorrectly assumed ICE server configs needed to be serialized to JSON before sending over the wire. The signature of bitbang-server accepts a hydrated []webrtc.ICEServers instance so now the cli sends the correct types.
63a47f7 to
ff9ad70
Compare
|
I cleaned up the wrong assumptions about the ICE server config type. The commit fixes the type and removes the unnecessary added helper methods. Note that in I refactored slightly (based on the above( to defer nil checks entirely since |
|
I'm getting a feel for this API and maybe we want to refactor more so that the With cloudflare, i might Let me know if that's better and I will add a conditional to detect the home directory. Edit: there could probably be a helper function that just totally handles file system path -> []webrtc.ICEServers. So throw the credential anywhere on the drive and it just works. |
|
2 items:
|
When creatingthe function NewClient_MaybeICE i missed copying some of the struct assignments. This commit fixes the panic. The app runs successfully now.
|
b347cc3 runs successfully. I was able to fix Let me know if you want any additional code or tests. |
|
Thanks for this -- nice work, and it works. :) I traced it against the server source and the Three things, all small, none of them the approach -- that part is right. Mostly polish 1. The nil check never fires, so every listener sends
|
ICE server configs can now be placed anywhere in the file system. Call sites to icehelper.ParseICEServers have been refactored to icehelper.AnyToICEServers calls.
|
Ok, a couple of improvements, and hopefully a refactor you are ok with in 4bfed7b:
|
|
Thanks! splitting the wire parse from the file parse is great, and Four things I hit while testing:
Rather than send you back a list, I put the fixes in the attached patch And sorry about the CI -- your runs were sitting waiting on me to approve them, which Last thing, whenever you get to it -- the branch is 15 commits behind main. Patch The conflict is in -- and |
Three crashes, all reachable from a normal run: - signaling.Client.OwnICEServers was a *[]webrtc.ICEServer that only `serve` set, so `bitbang share` and bitbangbench dereferenced nil at register. A slice is already nilable; the pointer bought nothing. - msg["ice_servers"].([]any) has no comma-ok, and the field is often absent: the server deletes it when it has no STUN to stamp, and the offer omits it when TURN is unavailable. That second case is the one the connector is supposed to survive by going direct. FromMessage restores the guard the old ParseICEServers had and puts the three call sites back to one line. - resolveFSPath sliced path[2:] on a leading "~", which is out of range for a bare "~" and eats a character of "~user/x". filepath.Abs already passes an absolute path through, so the branches collapse to two. Also renames UnMarshalUserIceJson to ParseUserICEFile, routes the startup errors through fail() so they reach stderr, and restores the icehelper tests -- they still referenced the removed ParseICEServers, so the package would not build under `go test ./...`. Their first case was "missing field returns nil", which is the second panic above.
Fixed stale function call after merging.
We added a clean function FromMessage() in the last PR patch which made AnyToICEServers unnecessary. We explicitly want only two API functions exposed here, to correspond with the two tasks: 1. parsing Message JSON and 2. parsing user JSON
EDIT: forgot to run |
|
Removing On Your instinct is circling a real case though: present but unparseable. That's our bug Two nits and then I think this is done:
Then mark it ready for review and I'll merge it. Thanks for sticking with this one -- |
Removed references to icehelper.ParseICEServer which now lives as a private function.
|
Fixed the nits. I marked it ready for review; i noticed in you patch you fixed the nil dereference in OwnICEServers by switching to a slice. I forgot to address that. thanks for the patch. |
|
Merged -- many thanks! |
`-ice-servers` shipped with the merge of #16 but nothing in the README mentioned it. Covers the three file shapes providers hand out, what the listener does with the config, and the distinction between who carries the traffic and who can read it -- a relay sees ciphertext either way, so this is about where the bytes go, not about privacy.
Implements #9 Bring your own TURN
Implemented the
--ice-serversflag and the associated app logic to handle passing custom ICE server configuration to the bitbang signalling server.In a slightly roundabout way, we take the user-supplied .json and validate it first by ensuring it parses to a
[]webrtc.ICEServer. Not long after, we covert it back to it's json representation for sending over the wire.Changed files
serve.go
ice-serversflagicehelpers.ParseICEServers()function to generate the aforementioned strong type instanceclient.go
register()we call the added helper functionAppendIceServerToMessage()to prep our Message.Tests