From 25622cbf259c702d29f31d40f996cb770e1a39ce Mon Sep 17 00:00:00 2001 From: pike Date: Wed, 9 Sep 2026 20:27:32 +0000 Subject: [PATCH] ops: Fix goimports on fair-share bandwidth PR --- cmd/root.go | 4 ++-- config/config.go | 2 +- config/config_test.go | 1 - steamcache/bandwidth_test.go | 18 +++++++++--------- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 1cfc913..ad39944 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -20,8 +20,8 @@ var ( logLevel string logFormat string - maxConcurrentRequests int64 - maxRequestsPerClient int64 + maxConcurrentRequests int64 + maxRequestsPerClient int64 uplinkBandwidth string maxBytesPerClientPerSec int64 ) diff --git a/config/config.go b/config/config.go index f0d3c14..265c9df 100644 --- a/config/config.go +++ b/config/config.go @@ -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) diff --git a/config/config_test.go b/config/config_test.go index 09b54c4..ad5ca2c 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -212,7 +212,6 @@ func TestValidate(t *testing.T) { } } - func TestValidateUplinkBandwidth(t *testing.T) { cases := []struct { name string diff --git a/steamcache/bandwidth_test.go b/steamcache/bandwidth_test.go index db08037..61a85ef 100644 --- a/steamcache/bandwidth_test.go +++ b/steamcache/bandwidth_test.go @@ -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 {