title: Golang gin get client IP in ipv4 only
body: <p>I'm trying to get the IP address of the client when using <code>gin-gonic</code> but sometimes it gives me the IPv6 address which I don't want.</p>
  
  <p>My current code looks like this:</p>
  
  <pre><code>web.POST("/path", func(c *gin.Context) {
      ipAddr := c.ClientIP() // sometimes ipv4, sometimes ipv6
  </code></pre>
  
  <p>How do I get only the IPv4 address?</p>
  
  <p>For reference I'm only listening on IPv4 address:</p>
  
  <pre><code>server := &amp;http.Server{
      Handler: router,
  }
  l, err := net.Listen("tcp4", cfg.Listen)
  if err != nil {
      panic(err)
  }
  err = server.Serve(l)
  </code></pre>
  
  <hr>
  
  <p>Here are examples of the IPv6 addresses I'm receiving: </p>
  
  <pre><code>2402:800:6371:2f72:xxxx:bf67:3689:95df
  2001:44b8:2169:c800:xxxx:c80a:b134:cc40
  </code></pre>