mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-06-21 05:46:34 +00:00

## Summary In order to make cloudflared behavior more predictable and prevent an exhaustion of resources, we have decided to add session limits that can be configured by the user. This first commit introduces the session limiter and adds it to the UDP handling path. For now the limiter is set to run only in unlimited mode.
21 lines
515 B
Go
21 lines
515 B
Go
// Copyright 2024 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
package http2
|
|
|
|
import "time"
|
|
|
|
// A timer is a time.Timer, as an interface which can be replaced in tests.
|
|
type timer = interface {
|
|
C() <-chan time.Time
|
|
Reset(d time.Duration) bool
|
|
Stop() bool
|
|
}
|
|
|
|
// timeTimer adapts a time.Timer to the timer interface.
|
|
type timeTimer struct {
|
|
*time.Timer
|
|
}
|
|
|
|
func (t timeTimer) C() <-chan time.Time { return t.Timer.C }
|