[management] use realip for proxy registration (#5525)

This commit is contained in:
Pascal Fischer
2026-03-06 16:11:44 +01:00
committed by GitHub
parent 85451ab4cd
commit e6587b071d
3 changed files with 4 additions and 9 deletions

View File

@@ -115,9 +115,9 @@ func (l *authFailureLimiter) stop() {
l.cancel()
}
// peerIPFromContext extracts the client IP from the gRPC context.
// PeerIPFromContext extracts the client IP from the gRPC context.
// Uses realip (from trusted proxy headers) first, falls back to the transport peer address.
func peerIPFromContext(ctx context.Context) clientIP {
func PeerIPFromContext(ctx context.Context) string {
if addr, ok := realip.FromContext(ctx); ok {
return addr.String()
}