Add wsl linter and fix

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-05-19 14:51:08 +04:00
parent eedfdcecc8
commit 9156d6a16a
882 changed files with 6068 additions and 574 deletions

View File

@@ -36,11 +36,13 @@ func Extract(r *http.Request) string {
if i := strings.LastIndexByte(xff, ','); i != -1 {
xff = xff[i+1:]
}
xff = strings.TrimSpace(xff)
if ip, _, err := net.SplitHostPort(xff); err == nil {
return ip
}
return xff
}
@@ -77,6 +79,7 @@ func parseForwardedFor(header string) string {
if ip, _, err := net.SplitHostPort(val); err == nil {
return ip
}
return val
}

View File

@@ -119,6 +119,7 @@ func TestExtract(t *testing.T) {
t.Parallel()
r := httptest.NewRequest("GET", "/", nil)
r.RemoteAddr = tt.remoteAddr
for k, v := range tt.headers {
r.Header.Set(k, v)