#warp #client #real-ip

warp-real-ip

Warp filter to get the "real ip" of the remote client

3 unstable releases

0.2.0 Jan 20, 2021
0.1.1 Jan 6, 2021
0.1.0 Dec 3, 2020

#8 in #real-ip

Download history 65/week @ 2026-01-06 44/week @ 2026-01-13 22/week @ 2026-01-20 20/week @ 2026-01-27 21/week @ 2026-02-03 10/week @ 2026-02-10 37/week @ 2026-02-17 61/week @ 2026-02-24 79/week @ 2026-03-03 141/week @ 2026-03-10 66/week @ 2026-03-17 40/week @ 2026-03-24 94/week @ 2026-03-31 55/week @ 2026-04-07 78/week @ 2026-04-14 28/week @ 2026-04-21

260 downloads per month
Used in webb-relayer

MIT/Apache

6KB
65 lines

wrap-real-ip

Warp filter to get the "real ip" of the remote client

This uses the "x-forwarded-for", "x-real-ip" or "forwarded" headers set by reverse proxies. To stop clients from abusing these headers, only headers set by trusted remotes will be accepted.

Example

use warp::Filter;
use warp_real_ip::real_ip;
use std::net::IpAddr;

let proxy_addr = [127, 10, 0, 1].into();
warp::any()
    .and(real_ip(vec![proxy_addr]))
    .map(|addr: Option<IpAddr>| format!("Hello {}", addr.unwrap()));

Dependencies

~13–27MB
~293K SLoC