fix(api): 仅信任配置的反向代理转发客户端 IP (#39)

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
fu500f
2026-10-31 00:44:04 +00:00
co-authored by Devin AI
parent 36f9c95fa7
commit 667e6d0f00
11 changed files with 373 additions and 15 deletions
+10
View File
@@ -0,0 +1,10 @@
package config
import "testing"
func TestLoadTrustedProxies(t *testing.T) {
t.Setenv("OPENGOODS_TRUSTED_PROXIES", "10.0.0.0/8")
if got := Load().TrustedProxies; got != "10.0.0.0/8" {
t.Fatalf("TrustedProxies = %q, want %q", got, "10.0.0.0/8")
}
}