logoalt Hacker News

s-macketoday at 12:01 PM1 replyview on HN

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/...

Replies

blainsmithtoday at 1:20 PM

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.