Skip to content

Add donor STUN configuration and IP-based fallback pool - #33

Merged
myleshorton merged 2 commits into
atavism/usermessagefrom
fix/donor-stun-config
Sep 10, 2026
Merged

Add donor STUN configuration and IP-based fallback pool#33
myleshorton merged 2 commits into
atavism/usermessagefrom
fix/donor-stun-config

Conversation

@myleshorton

@myleshorton myleshorton commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Adds UnboundedConfig.stun_servers and 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.

Copilot AI lite review requested due to automatic review settings September 10, 2026 14:49
@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 9a87ee36-f757-4c13-a329-08231ee3fa62

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/donor-stun-config

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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.STUNServers with stun_servers JSON 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.Marshal and json.Unmarshal would use the same incorrect key. Since stun_servers is the compatibility wire contract, assert that encoded contains 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 omitempty omitting both a nil and a non-nil empty STUNServers slice, 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 emit stun_servers unexpectedly.
	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.

@myleshorton

Copy link
Copy Markdown
Contributor Author

Addressed both test findings from the Copilot review in f825bae: the round-trip test now explicitly asserts the stun_servers JSON key, and TestDonorSTUNConfigOmission verifies both nil and non-nil empty lists serialize without that key. go test ./... -timeout=90s passes. These were review-body findings, so there are no inline threads to resolve. The companion PRs continue pinning 674a990 because this follow-up only changes tests.

@myleshorton
myleshorton merged commit 2a9a18d into atavism/usermessage Sep 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants