Comment by s-macke

4 hours ago

I wish I had known this two years ago. I ended up writing my own embedded connection struct to trace these things [0].

  type Connection struct {
    net.Conn
    OnEventCallback func(clientClosed bool, serverClosed bool, err error)
  }

[0] https://github.com/s-macke/SlapperX/blob/master/src/tracing/...

That get's the job done too for those events depending on what you need them for. httptrace could be heavy handed if all you want is simple events like you show.