How to get IP address using warp

Hello,
I use warp in order to develop an API.
Let's see some code:

let r = warp::path("test");
let r_routes = r
        .and(warp::get())
        .and(with_db(db_pool.clone()))
        .and_then(handlers::r::test) ;

For sake of simplicity, i only show one endpoint.

When a client make a GET request to the test endpoint, it works well, and replies with a StatusCode:OK.

How to get the address IP of the client? Maybe using some Filters?

Thanks in advance ^

There's a filter: warp::filters::addr::remote.

1 Like