gin icon indicating copy to clipboard operation
gin copied to clipboard

When will GIN-GONIC ever support ipv6 in the request logs?!?

Open encryptblockr opened this issue 7 months ago • 2 comments

It has been centuries since gin-gonic has been released and ipv6 has been around for decades now, so why is support still only for ipv4 and no ipv6 in the request logs???

/endpoint-1 shows the request ip because it is ipv4 but /endpoint-2 request is from ipv6 ip and no show

for years now i have been angry at this and still till today gin-gonic will not add support for ipv6, why????

[GIN] 2025/05/18 - 02:17:58 | 200 | 40.419563613s |   3.239.193.221 | GET      "/endpoint-1"

[GIN] 2025/05/18 - 02:37:41 | 200 |   17.644075ms |                 | GET      "/endpoint-2"

encryptblockr avatar May 18 '25 02:05 encryptblockr

I can try to fix this

r0ld3x avatar Jun 06 '25 16:06 r0ld3x

How do you call the Gin-Server? For me IPv6 adresses are shown in the log if the client calls with an IPv6 adress:

Call with curl an IPv6:

curl -6 http://[2003:de:ef25:XXXX:XXXX:XXXX:XXXX:XXXX]:8080

Log says:

[GIN] 2025/06/24 - 15:31:54 | 404 | 2.267µs | 2003:de:ef25:XXXX:XXXX:XXXX:XXXX:XXXX | GET "/"

Do you have a proxy in front of your server? The function gin.Context#ClientIP is used for logging. Maybe you check: https://github.com/gin-gonic/gin/blob/master/context.go#L902

kkoehler avatar Jun 24 '25 13:06 kkoehler