Conversation
Add BanditURLOverrides field to ConfigResponse to support per-proxy callback URLs for the bandit Thompson sampling proxy assignment system. Also add Version field to ConfigRequest. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds the UnboundedConfig struct with discovery/egress URLs and table sizes, an Unbounded pointer field on ConfigResponse, and the UNBOUNDED feature flag constant. This allows the API to tell clients when to run as a broflake widget proxy to help censored users. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds configuration support for the unbounded widget proxy feature, which allows the API to tell clients when to run as a "broflake widget proxy" to help censored users. The changes introduce a new configuration struct and feature flag, along with additional fields to the existing configuration types.
Changes:
- Adds
UNBOUNDEDfeature flag constant for enabling the unbounded widget proxy - Adds
UnboundedConfigstruct with discovery/egress URLs and table size configuration - Adds
Unboundedfield toConfigResponseto deliver widget proxy configuration to clients - Adds
BanditURLOverridesfield toConfigResponsefor Thompson sampling system - Adds
Versionfield toConfigRequestfor client version tracking
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // server to detect which proxies successfully connected. | ||
| BanditURLOverrides map[string]string `json:"bandit_url_overrides,omitempty"` | ||
|
|
||
| Unbounded *UnboundedConfig `json:"unbounded,omitempty"` |
There was a problem hiding this comment.
The newly added Unbounded field in ConfigResponse lacks test coverage. The existing tests (TestConfigResponseSerialization) cover serialization of ConfigResponse fields, but don't include the new Unbounded field. Consider adding a test case that includes an UnboundedConfig instance to ensure proper JSON serialization and deserialization of all fields including DiscoverySrv, DiscoveryEndpoint, EgressAddr, EgressEndpoint, CTableSize, and PTableSize.
| // BanditURLOverrides maps outbound tags to per-proxy callback URLs for | ||
| // the bandit Thompson sampling system. When set, these override the | ||
| // default MutableURLTest URL for each specific outbound, allowing the | ||
| // server to detect which proxies successfully connected. | ||
| BanditURLOverrides map[string]string `json:"bandit_url_overrides,omitempty"` |
There was a problem hiding this comment.
The BanditURLOverrides field is not mentioned in the PR description. The PR description states it "Adds UnboundedConfig struct" and "Adds Unbounded field to ConfigResponse", but does not mention this bandit-related field. If this field is intentional and part of this PR, please update the PR description to include it. If it was added unintentionally, it should be removed.
| Locale string `json:"locale,omitempty"` | ||
| Protocols []string `json:"protocols,omitempty"` | ||
| MetricsOptedIn bool `json:"metrics_opted_in,omitempty"` | ||
| Version string `json:"version,omitempty"` |
There was a problem hiding this comment.
The Version field added to ConfigRequest is not mentioned in the PR description. The PR description only mentions additions related to UnboundedConfig. If this field is intentional and part of this PR, please update the PR description to include it. If it was added unintentionally, it should be removed.
| type UnboundedConfig struct { | ||
| DiscoverySrv string `json:"discovery_srv,omitempty"` | ||
| DiscoveryEndpoint string `json:"discovery_endpoint,omitempty"` | ||
| EgressAddr string `json:"egress_addr,omitempty"` | ||
| EgressEndpoint string `json:"egress_endpoint,omitempty"` | ||
| CTableSize int `json:"ctable_size,omitempty"` | ||
| PTableSize int `json:"ptable_size,omitempty"` |
There was a problem hiding this comment.
The UnboundedConfig struct lacks documentation. Following the pattern established in the codebase (e.g., RuleSet at lines 54-62), the struct fields should have inline comments explaining their purpose, especially for fields that may not be self-explanatory like CTableSize and PTableSize. Consider adding comments that explain what "discovery", "egress", and the table sizes represent in the context of the unbounded widget proxy.
| type UnboundedConfig struct { | |
| DiscoverySrv string `json:"discovery_srv,omitempty"` | |
| DiscoveryEndpoint string `json:"discovery_endpoint,omitempty"` | |
| EgressAddr string `json:"egress_addr,omitempty"` | |
| EgressEndpoint string `json:"egress_endpoint,omitempty"` | |
| CTableSize int `json:"ctable_size,omitempty"` | |
| PTableSize int `json:"ptable_size,omitempty"` | |
| // UnboundedConfig configures the client-side unbounded widget proxy. | |
| type UnboundedConfig struct { | |
| // DiscoverySrv is the DNS SRV record used to discover unbounded widget proxy | |
| // backends when SRV-based service discovery is enabled. | |
| DiscoverySrv string `json:"discovery_srv,omitempty"` | |
| // DiscoveryEndpoint is the HTTP(S) endpoint used to discover unbounded widget | |
| // proxy backends when not relying on SRV records. | |
| DiscoveryEndpoint string `json:"discovery_endpoint,omitempty"` | |
| // EgressAddr is the local or remote address that the unbounded widget proxy | |
| // should use for sending egress traffic (for example, a bound IP/port). | |
| EgressAddr string `json:"egress_addr,omitempty"` | |
| // EgressEndpoint is the HTTP(S) endpoint through which the unbounded widget | |
| // proxy sends its egress traffic once a backend has been selected. | |
| EgressEndpoint string `json:"egress_endpoint,omitempty"` | |
| // CTableSize controls the size of the connection table used by the unbounded | |
| // widget proxy to track active or recently active connections. | |
| CTableSize int `json:"ctable_size,omitempty"` | |
| // PTableSize controls the size of the path/table used by the unbounded widget | |
| // proxy to maintain per-path or per-peer state. | |
| PTableSize int `json:"ptable_size,omitempty"` |
| } | ||
|
|
||
| type UnboundedConfig struct { | ||
| DiscoverySrv string `json:"discovery_srv,omitempty"` |
There was a problem hiding this comment.
The field name DiscoverySrv uses the abbreviation "Srv" which is inconsistent with the rest of the codebase. Other fields use full words rather than abbreviations (e.g., ServerLocation, Servers, StunServers in config/types.pb.go). Consider renaming this to DiscoveryServer for consistency, unless "Srv" has a specific technical meaning in the unbounded widget proxy context.
Summary
UnboundedConfigstruct with discovery/egress URLs and table sizesUnbounded *UnboundedConfigfield toConfigResponseUNBOUNDEDfeature flag constantPart of the unbounded widget proxy feature — allows the API to tell clients when to run as a broflake widget proxy to help censored users.
🤖 Generated with Claude Code