How to get ip and hostname of client

When client is initiating a request to access the restapi, i need them to pass the details of hostname and IP on the same resource of the url and capture it in the log. Please help me with the sample code.

2 Likes

This might do what you want: https://github.com/tomasen/realip

2 Likes

This post helps to get the IP address of a HTTP request, if i understood the question correctly. https://golangcode.com/get-the-request-ip-addr/

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.