Since golang 1.17 HTTP tracing was added providing valuable tracing hooks, alas, I am trying to get the connection information attempt (or, before it is established) and not the information on the established connection - what I am looking is the connection four tuple (source ip, source port, destination ip, destination port) which I can only get using -
trace := &httptrace.ClientTrace{
// This is called once the TCP handshake has already been established
GotConn: func(connInfo httptrace.GotConnInfo) {
// Access the connection information
conn := connInfo.Conn
// Contains source ip & port
localAddr := conn.LocalAddr()
// contains the destination ip & port
remoteAddr := conn.RemoteAddr()
}
...
}
Is there any way to trace the attempt information? (i.e. right before the TCP SYN packet is sent for the TCP handshake?) I know I can use GetConn hook but it only provides the remote address and not the local one as well, unfortunately.