feat: add ConfigRequest.Capabilities for client capability negotiation#28
feat: add ConfigRequest.Capabilities for client capability negotiation#28myleshorton wants to merge 2 commits into
Conversation
Adds a Capabilities []string field to ConfigRequest and the first capability
constant, CapabilityNonSelectableOutbounds ("non_selectable_outbounds"): the
client advertises that it honors ConfigResponse.NonSelectableOutbounds so the
server can gate infrastructure outbounds (e.g. a proxyless download_detour) on
the capability instead of sniffing the client version. Future optional outbounds
reuse the same signal — no new token per feature.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGpKfgkbfdJwwsTaouMDoR
|
Warning Review limit reached
Next review available in: 41 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR adds a new ChangesCapabilities support
Estimated code review effort: 1 (Trivial) | ~5 minutes Related PRs: None found. Suggested labels: enhancement Suggested reviewers: None specified. 🐰 A whisker-twitch, a new field appears, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds explicit client capability negotiation to the shared common types so servers can safely enable optional behaviors based on what the client reports (instead of relying on version floors), starting with support for ConfigResponse.NonSelectableOutbounds.
Changes:
- Add
ConfigRequest.Capabilities []stringfor client-advertised capabilities. - Introduce
CapabilityNonSelectableOutbounds = "non_selectable_outbounds"constant with documentation. - Add a JSON round-trip test covering presence and
omitemptybehavior forCapabilities.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| types.go | Adds ConfigRequest.Capabilities plus the first capability constant used for negotiation. |
| types_test.go | Adds TestCapabilitiesRoundTrip to verify serialization/deserialization and omitempty omission behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@coderabbitai full review |
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 50 minutes. |
Use `"capabilities"` (with quotes) so the omit check can't false-positive on a bare substring in a value, consistent with the positive assertion. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGpKfgkbfdJwwsTaouMDoR
|
@coderabbitai full review |
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 41 minutes. |
What
Add a
Capabilities []stringfield toConfigRequestand the first capability constant:The client advertises capabilities it supports; the server enables optional behavior only for clients that report the matching capability — capability negotiation instead of version sniffing.
Why
lantern-cloud gates its new proxyless rule-set detour (an infrastructure outbound sent via
ConfigResponse.NonSelectableOutbounds) on whether the client will treat that outbound as non-selectable. A client that doesn't (pre–getlantern/radiance#549) would let its URLTest auto-select the low-latency direct+frag dialer and route traffic through it — exposing the real IP.The current gate is a hardcoded client-version floor (
9.1.14-beta). A capability is strictly better:NonSelectableOutbounds" is exactly the property that matters — not a version number that has to be kept in sync with whichever release happened to carry #549 (and breaks across forks/prereleases).NonSelectableOutbounds. Gating on this one capability covers every future infra outbound with no new token and no client release — the whole point ofNonSelectableOutbounds. Gating on"proxyless"specifically would need a new token per outbound.non_selectable_outbounds" ↔ the server sendsnon_selectable_outbounds.Note: the client already advertises the outline outbound type (
"outline") via its auto-derived supported-protocols list, but that predates #549 — so it can't be used as the gate (old clients report it too). This new, explicitly-added capability is the safe signal.Consumers
CapabilityNonSelectableOutboundsinconfig/fetcher.go(added in the same code that honorsNonSelectableOutbounds, so advertising it ⟺ handling it safely).slices.Contains(req.Capabilities, common.CapabilityNonSelectableOutbounds), replacing the version floor.Testing
go test ./...—TestCapabilitiesRoundTrip(key present, value round-trips, nil + empty-slice both omitted). Build + gofmt clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01WGpKfgkbfdJwwsTaouMDoR
Summary by CodeRabbit
New Features
Tests