How to get ip and hostname of client


(DINESH) #1

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.


(Sean Killian) #2

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


(Justin) #3

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/