server: trusted_proxies – X-Forwarded-For für Rate-Limit hinter Reverse-Proxy
This commit is contained in:
parent
97646da970
commit
126f4be2b9
6 changed files with 101 additions and 7 deletions
|
|
@ -3,9 +3,10 @@ package server
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"log/slog"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
|
@ -38,6 +39,8 @@ type Server struct {
|
|||
AllowRegistration bool
|
||||
// TokenTTL is the lifetime of user tokens (default 30 days).
|
||||
TokenTTL time.Duration
|
||||
// TrustedProxies whose X-Forwarded-For is honoured (empty = loopback only).
|
||||
TrustedProxies []*net.IPNet
|
||||
|
||||
authOnce sync.Once
|
||||
limiter *limiter
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue