ops: Fix goimports on fair-share bandwidth PR
CI / vulncheck (pull_request) Successful in 14s
CI / check-and-test (pull_request) Successful in 51s
CI / vulncheck (push) Successful in 14s
CI / check-and-test (push) Successful in 50s
Release Tag / release (push) Successful in 20s

This commit was merged in pull request #54.
This commit is contained in:
2026-09-09 20:27:32 +00:00
parent b7710de0ca
commit 25622cbf25
4 changed files with 12 additions and 13 deletions
+2 -2
View File
@@ -20,8 +20,8 @@ var (
logLevel string
logFormat string
maxConcurrentRequests int64
maxRequestsPerClient int64
maxConcurrentRequests int64
maxRequestsPerClient int64
uplinkBandwidth string
maxBytesPerClientPerSec int64
)
+1 -1
View File
@@ -21,7 +21,7 @@ type Config struct {
// Table-tier uplink bandwidth shaping (bytes/sec). Distinct from MaxRequestsPerClient.
// Empty/"0" uplink and 0 max_bytes_per_client_per_sec = disabled (current unlimited behavior).
UplinkBandwidth string `yaml:"uplink_bandwidth"` // e.g. "10MB" via go-units = bytes/sec
UplinkBandwidth string `yaml:"uplink_bandwidth"` // e.g. "10MB" via go-units = bytes/sec
MaxBytesPerClientPerSec int64 `yaml:"max_bytes_per_client_per_sec"` // absolute per-client cap; 0 = none
// Hardening limits (security/correctness)
-1
View File
@@ -212,7 +212,6 @@ func TestValidate(t *testing.T) {
}
}
func TestValidateUplinkBandwidth(t *testing.T) {
cases := []struct {
name string
+9 -9
View File
@@ -93,15 +93,15 @@ func TestServeHTTPBandwidthCap(t *testing.T) {
t.Cleanup(upstream.Close)
sc, err := NewWithOptions(Options{
Address: "127.0.0.1:0",
MemorySize: "1MB",
DiskSize: "0",
Upstream: upstream.URL,
MemoryGC: "lru",
DiskGC: "lru",
MaxConcurrentRequests: 20,
MaxRequestsPerClient: 10,
MaxObjectSize: "0",
Address: "127.0.0.1:0",
MemorySize: "1MB",
DiskSize: "0",
Upstream: upstream.URL,
MemoryGC: "lru",
DiskGC: "lru",
MaxConcurrentRequests: 20,
MaxRequestsPerClient: 10,
MaxObjectSize: "0",
MaxBytesPerClientPerSec: 1500, // 1.5KB/s
})
if err != nil {