How can I get the client's Ip address in jsonrpc-http-server (hyper)

I'm using jsonrpc-http and jsonrpc-core from paritytech.

I want to code a rate-limit by IP but I can't find a way to access the IP Address. Jsonrpc-http is using hyper under the hood. I've tried using the MetaExtractor but it only gives me access to the hyper::Request<hyper::Body> and I need a hyper::server::conn::AddrStream.

Do I need to tinker with the source-code of the lib? Or how can I do this? All help appreciated

As far as I can see, the jsonrpc_http_server implementation just ignores the AddrStream that's passed to it by hyper:

So you can't access the clients' IP addresses through jsonrpc_http_server without modifying the library. You could open a GitHub issue to see whether the maintainers are amenable to making these modifications upstream.

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.