feat(netxlite): add CloseIdleConnections to quic dialer (#469)
Like before, do not touch the rest of the tree. Rather create compatibility types declared as legacy. We will soon be able to close idle connections for an HTTP3 transport using any kind of resolvers more easily. See https://github.com/ooni/probe/issues/1591
This commit is contained in:
parent
aa77867145
commit
3ba5626b95
10 changed files with 209 additions and 21 deletions
|
|
@ -21,18 +21,27 @@ func (ql *QUICListener) Listen(addr *net.UDPAddr) (quicx.UDPLikeConn, error) {
|
|||
return ql.MockListen(addr)
|
||||
}
|
||||
|
||||
// QUICContextDialer is a mockable netxlite.QUICContextDialer.
|
||||
type QUICContextDialer struct {
|
||||
// QUICDialer is a mockable netxlite.QUICDialer.
|
||||
type QUICDialer struct {
|
||||
// MockDialContext allows mocking DialContext.
|
||||
MockDialContext func(ctx context.Context, network, address string,
|
||||
tlsConfig *tls.Config, quicConfig *quic.Config) (quic.EarlySession, error)
|
||||
|
||||
// MockCloseIdleConnections allows mocking CloseIdleConnections.
|
||||
MockCloseIdleConnections func()
|
||||
}
|
||||
|
||||
// DialContext calls MockDialContext.
|
||||
func (qcd *QUICContextDialer) DialContext(ctx context.Context, network, address string,
|
||||
func (qcd *QUICDialer) DialContext(ctx context.Context, network, address string,
|
||||
tlsConfig *tls.Config, quicConfig *quic.Config) (quic.EarlySession, error) {
|
||||
return qcd.MockDialContext(ctx, network, address, tlsConfig, quicConfig)
|
||||
}
|
||||
|
||||
// CloseIdleConnections calls MockCloseIdleConnections.
|
||||
func (qcd *QUICDialer) CloseIdleConnections() {
|
||||
qcd.MockCloseIdleConnections()
|
||||
}
|
||||
|
||||
// QUICEarlySession is a mockable quic.EarlySession.
|
||||
type QUICEarlySession struct {
|
||||
MockAcceptStream func(context.Context) (quic.Stream, error)
|
||||
|
|
|
|||
Loading…
Reference in a new issue