I need to use LocalAddr() and/or RemoteAddr() on a pipe connection to log the client in a multiple-client setup. Unfortunately it always returns the same string for all connections on the same pipe address.
What I do now after accept is rather ugly and needs special handling for different connection types:
type fdInterface interface {
Fd() uintptr
}
...
c, err := l.Accept()
if err != nil {
return err
}
// create a sub-logger for each client connection
cl := log.Logger.With().Str("client", fmt.Sprint(c.(fdInterface).Fd())).Logger()
Can you imagine a way how to remedy the situation? I'd submit a PR if we can agree on smthng.
I need to use
LocalAddr()
and/orRemoteAddr()
on a pipe connection to log the client in a multiple-client setup. Unfortunately it always returns the same string for all connections on the same pipe address.What I do now after accept is rather ugly and needs special handling for different connection types:
Can you imagine a way how to remedy the situation? I'd submit a PR if we can agree on smthng.