MCPcopy
hub / github.com/tailscale/tailscale / init

Function init

wgengine/filter/filter.go:333–340  ·  view source on GitHub ↗

NOTE(Xe): This func init is used to detect TS_DEBUG_FILTER_RATE_LIMIT_LOGS=all, and if it matches, to effectively disable the limits on the log rate by setting the limit to 1 millisecond. This should capture everything.

()

Source from the content-addressed store, hash-verified

331// effectively disable the limits on the log rate by setting the limit
332// to 1 millisecond. This should capture everything.
333func init() {
334 if envknob.String("TS_DEBUG_FILTER_RATE_LIMIT_LOGS") != "all" {
335 return
336 }
337
338 acceptBucket = rate.NewLimiter(rate.Every(time.Millisecond), 10)
339 dropBucket = rate.NewLimiter(rate.Every(time.Millisecond), 10)
340}
341
342func (f *Filter) logRateLimit(runflags RunFlags, q *packet.Parsed, dir direction, r Response, why string) {
343 if runflags == 0 || !f.loggingAllowed(q) {

Callers

nothing calls this directly

Calls 3

StringFunction · 0.92
NewLimiterFunction · 0.92
EveryFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…