Add donor STUN configuration and IP-based fallback pool - #33
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
b1548ba to
674a990
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Address the two moderate test-coverage issues in types_test.go.
Pull request overview
Adds optional donor STUN configuration and an IP-based fallback pool for WebRTC initialization.
Changes:
- Adds
UnboundedConfig.STUNServerswithstun_serversJSON compatibility. - Adds a fresh-slice default STUN server pool.
- Adds serialization and slice-isolation tests.
File summaries
| File | Summary | Findings |
|---|---|---|
types.go |
Defines STUN configuration and fallback servers. | None |
types_test.go |
Tests serialization and fallback slice isolation. | Two moderate findings: assert the exact JSON key and cover nil/empty omission cases. |
Review details
Suppressed comments (2)
types_test.go:279
- The round-trip assertion cannot detect a wrong or missing JSON tag:
json.Marshalandjson.Unmarshalwould use the same incorrect key. Sincestun_serversis the compatibility wire contract, assert thatencodedcontains the exact key (as the neighboring field tests do) so a future tag regression fails.
encoded, err := json.Marshal(original)
assert.NoError(t, err)
var decoded UnboundedConfig
assert.NoError(t, json.Unmarshal(encoded, &decoded))
assert.Equal(t, original.STUNServers, decoded.STUNServers)
types_test.go:279
- The compatibility promise depends on
omitemptyomitting both a nil and a non-nil emptySTUNServersslice, but this test only covers a populated list. Please add the nil/empty cases (as the neighboring slice-field tests do) so a future tag or type regression cannot make older clients emitstun_serversunexpectedly.
encoded, err := json.Marshal(original)
assert.NoError(t, err)
var decoded UnboundedConfig
assert.NoError(t, json.Unmarshal(encoded, &decoded))
assert.Equal(t, original.STUNServers, decoded.STUNServers)
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Addressed both test findings from the Copilot review in f825bae: the round-trip test now explicitly asserts the |
Adds
UnboundedConfig.stun_serversand a shared IP-based fallback pool so donor clients can initialize WebRTC without downloading a STUN list from GitHub. The optional field preserves compatibility with older servers and clients; the fallback returns a fresh slice on each call.Stacked on #32 because current API and Radiance main already pin that user-message contract. Keeping this base preserves those packages when the consumers bump their dependency. Merge #32 first, then retarget this PR to main.
Validation:
go test ./...; all eight fallback servers answered live STUN binding requests during investigation. Comment review completed.Companions: getlantern/radiance#634 and https://github.com/getlantern/lantern-cloud/pull/3324. This provides the configuration contract; it does not change the default broflake fetcher.