The term keep-alive means different things in the two contexts.
The net/http Transport documentation uses the term to refer to persistent connections. A keep-alive or persistent connection is a connection that can be used for more than one HTTP transaction.
The Transport.IdleConnTimeout field specifies how long the transport keeps an unused connection in the pool before closing the connection.
The net Dialer documentation uses the keep-alive term to refer the TCP feature for probing the health of a connection.
Dialer.KeepAlive field specifies how frequently TCP keep-alive probes are sent to the peer.
The two settings do different things at different layers in the stack.
1
solved What is the difference between net.Dialer#KeepAlive and http.Transport#IdleTimeout?