Golang杜松子酒仅在ipv4中获取客户端IP

I'm trying to get the IP address of the client when using gin-gonic but sometimes it gives me the IPv6 address which I don't want.

My current code looks like this:

web.POST("/path", func(c *gin.Context) {
    ipAddr := c.ClientIP() // sometimes ipv4, sometimes ipv6

How do I get only the IPv4 address?

For reference I'm only listening on IPv4 address:

server := &http.Server{
    Handler: router,
}
l, err := net.Listen("tcp4", cfg.Listen)
if err != nil {
    panic(err)
}
err = server.Serve(l)

Here are examples of the IPv6 addresses I'm receiving:

2402:800:6371:2f72:xxxx:bf67:3689:95df
2001:44b8:2169:c800:xxxx:c80a:b134:cc40