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 ^

1 Like

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

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.