ClientIP: check every proxy for trustiness (#2844)

This commit is contained in:
Egor Seredin
2021-10-09 09:38:51 +09:00
committed by GitHub
parent 21125bbb3f
commit 5929d52171
2 changed files with 21 additions and 20 deletions

View File

@ -1419,7 +1419,7 @@ func TestContextClientIP(t *testing.T) {
// Only trust RemoteAddr
_ = c.engine.SetTrustedProxies([]string{"40.40.40.40"})
assert.Equal(t, "20.20.20.20", c.ClientIP())
assert.Equal(t, "30.30.30.30", c.ClientIP())
// All steps are trusted
_ = c.engine.SetTrustedProxies([]string{"40.40.40.40", "30.30.30.30", "20.20.20.20"})