Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions banditcallback/banditcallback.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,17 @@ type Emitter struct {

// New returns an emitter. token and callbackURL come from the daemon's
// INI (banditcallbacktoken / banditcallbackurl). ttl is the per-device
// dedup window — typically matches the API-side ProbeTTLForPollInterval
// at the daemon's expected poll. Zero ttl uses 10m as a sensible default.
// dedup window — also the heartbeat cadence: while a device keeps
// using the proxy, it triggers a callback at most once per ttl. The
// API side uses absence of those heartbeats as its only available
// signal for censorship blocking (the proxy itself can't observe a
// blocked connection because the client never reaches it), so ttl
// must stay short enough that an absence is detected before users
// suffer. Zero ttl uses 60s as a sensible default. Keep this in lock-
// step with bandit.ArmCallbackHeartbeatWindow on the API side.
func New(token, callbackURL string, ttl time.Duration) *Emitter {
if ttl <= 0 {
ttl = 10 * time.Minute
ttl = 60 * time.Second
}
return &Emitter{
token: token,
Expand Down
2 changes: 1 addition & 1 deletion http-proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ var (
// the same binary without firing any callbacks.
banditCallbackToken = flag.String("banditcallbacktoken", "", "Per-arm bandit callback token plumbed by the provisioner")
banditCallbackURL = flag.String("banditcallbackurl", "", "Full URL of the /v1/bandit/callback endpoint")
banditCallbackTTL = flag.Duration("banditcallbackttl", 10*time.Minute, "Per-device dedup window for bandit callback emission")
banditCallbackTTL = flag.Duration("banditcallbackttl", 60*time.Second, "Per-device dedup window and heartbeat cadence for bandit callback emission. The API's absence-reaper expects a callback within ArmCallbackHeartbeatWindow (~90s) of the previous one; values much smaller than that just amplify callback traffic, values larger risk false-positive negative rewards on idle clients.")

throttleRefreshInterval = flag.Duration("throttlerefresh", throttle.DefaultRefreshInterval, "Specifies how frequently to refresh throttling configuration from redis. Defaults to 5 minutes.")

Expand Down
Loading