get_client_ip

Function get_client_ip 

Source
pub fn get_client_ip(headers: &HeaderMap, extensions: &Extensions) -> String
Expand description

Extracts the client IP address from HTTP headers and extensions.

This function checks headers in order of priority:

  1. X-Forwarded-For (leftmost IP is the original client when behind proxies)
  2. X-Real-IP (used by some proxies like nginx)
  3. Socket address from extensions (direct connection)

Returns “unknown” if no IP can be extracted.