How to reproduce

package main

import (
    "github.com/gin-gonic/gin"
)

func main() {
    gin.Default().RunUnix("./example.sock")
}

Expectations

ClientIP() and should actually treat unix socket as trusted proxy and return the real client IP as specified in docs

Actual result

Empty string is returned due to Context.RemoteIP() failing with nil, false when dealing with non-ip network listener

Environment

  • gin version: 1.7.1 (broken since #2632)

Comment From: wgjtyu

https://github.com/gin-gonic/gin/issues/2962#issuecomment-980539549