title: How to get client ip address using gorilla/mux - GoLang
body: <p>I am implementing an API application in golang using gorilla/mux which is a powerfull library, tends to help to build web APIs,</p>
  <p>However i need to keep ip address for each client for that how can i get ip address for each client who visits website?</p>
  <p>Code:</p>
  <pre class="lang-golang prettyprint-override"><code>func GetIpAddress(w http.ResponseWriter, r *http.Request){
      // Whenever User visits this URL (this function)
      // We have to know IP Address of user
      output := r.UserAgent()
      fmt.Print(&quot;Output : &quot;, output)
      // But var (output) returns whole string excluding clients ip address
  }
  </code></pre>