The http2 Transport exposes a CloseIdleConnections method that will call the method of the same name on the ClientConnPool if it implements the private clientConnPoolIdleCloser interface. The ClientConnPool implementation calls the private method closeIfIdle on each pooled ClientConn.
If one want to create a custom ClientConnPool, there is no way to make this custom pool support this feature without exposing CloseIfIdle method and ClientConnPoolIdleCloser interface.
The http2
Transportexposes aCloseIdleConnectionsmethod that will call the method of the same name on theClientConnPoolif it implements the privateclientConnPoolIdleCloserinterface. TheClientConnPoolimplementation calls the private methodcloseIfIdleon each pooledClientConn.If one want to create a custom
ClientConnPool, there is no way to make this custom pool support this feature without exposingCloseIfIdlemethod andClientConnPoolIdleCloserinterface.