xfy 2734b04d8f refactor: remove 16.8k lines of dead code across all internal packages
- Delete unused files: tempfile subsystem, matcher variants, server/internal
- Remove 200+ unused functions across proxy, ssl, lua, http2/3, stream, variable
- Fix proxy test type errors (backgroundRefresh ctx→Request)
- Move bench/tools mock backend into internal/testutil
- Remove corresponding test functions for all deleted code
2026-06-03 16:15:43 +08:00

20 lines
357 B
Go

package limitrate
import (
"io"
"sync"
"time"
)
// RateLimitedWriter 限速写入器,使用令牌桶算法
type RateLimitedWriter struct {
writer io.Writer
rate int64 // 字节/秒
bucket int64 // 当前令牌数
maxBucket int64 // 令牌桶最大容量
lastTime time.Time // 上次更新时间
mu sync.Mutex
}