update quic-go to v0.20.0

This commit is contained in:
Marten Seemann 2021-03-19 12:24:20 +08:00
parent 870bb163b3
commit 781356a858
5 changed files with 22 additions and 23 deletions

View File

@ -195,7 +195,7 @@ var _ = Describe("Connection", func() {
// now allow the address and make sure the connection goes through
cg.EXPECT().InterceptAccept(gomock.Any()).Return(true)
cg.EXPECT().InterceptSecured(gomock.Any(), gomock.Any(), gomock.Any()).Return(true)
clientTransport.(*transport).clientConfig.HandshakeTimeout = 2 * time.Second
clientTransport.(*transport).clientConfig.HandshakeIdleTimeout = 2 * time.Second
conn, err = clientTransport.Dial(context.Background(), ln.Multiaddr(), serverID)
Expect(err).ToNot(HaveOccurred())
defer conn.Close()
@ -221,7 +221,7 @@ var _ = Describe("Connection", func() {
// now allow the peerId and make sure the connection goes through
cg.EXPECT().InterceptSecured(gomock.Any(), gomock.Any(), gomock.Any()).Return(true)
clientTransport.(*transport).clientConfig.HandshakeTimeout = 2 * time.Second
clientTransport.(*transport).clientConfig.HandshakeIdleTimeout = 2 * time.Second
conn, err := clientTransport.Dial(context.Background(), ln.Multiaddr(), serverID)
Expect(err).ToNot(HaveOccurred())
conn.Close()

View File

@ -83,7 +83,7 @@ func (l *listener) setupConn(sess quic.Session) (*conn, error) {
// Since we don't have any way of knowing which tls.Config was used though,
// we have to re-determine the peer's identity here.
// Therefore, this is expected to never fail.
remotePubKey, err := p2ptls.PubKeyFromCertChain(sess.ConnectionState().PeerCertificates)
remotePubKey, err := p2ptls.PubKeyFromCertChain(sess.ConnectionState().TLS.PeerCertificates)
if err != nil {
return nil, err
}

View File

@ -14,30 +14,30 @@ import (
multiaddr "github.com/multiformats/go-multiaddr"
)
// MockConnectionGater is a mock of ConnectionGater interface
// MockConnectionGater is a mock of ConnectionGater interface.
type MockConnectionGater struct {
ctrl *gomock.Controller
recorder *MockConnectionGaterMockRecorder
}
// MockConnectionGaterMockRecorder is the mock recorder for MockConnectionGater
// MockConnectionGaterMockRecorder is the mock recorder for MockConnectionGater.
type MockConnectionGaterMockRecorder struct {
mock *MockConnectionGater
}
// NewMockConnectionGater creates a new mock instance
// NewMockConnectionGater creates a new mock instance.
func NewMockConnectionGater(ctrl *gomock.Controller) *MockConnectionGater {
mock := &MockConnectionGater{ctrl: ctrl}
mock.recorder = &MockConnectionGaterMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockConnectionGater) EXPECT() *MockConnectionGaterMockRecorder {
return m.recorder
}
// InterceptAccept mocks base method
// InterceptAccept mocks base method.
func (m *MockConnectionGater) InterceptAccept(arg0 network.ConnMultiaddrs) bool {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "InterceptAccept", arg0)
@ -45,13 +45,13 @@ func (m *MockConnectionGater) InterceptAccept(arg0 network.ConnMultiaddrs) bool
return ret0
}
// InterceptAccept indicates an expected call of InterceptAccept
// InterceptAccept indicates an expected call of InterceptAccept.
func (mr *MockConnectionGaterMockRecorder) InterceptAccept(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InterceptAccept", reflect.TypeOf((*MockConnectionGater)(nil).InterceptAccept), arg0)
}
// InterceptAddrDial mocks base method
// InterceptAddrDial mocks base method.
func (m *MockConnectionGater) InterceptAddrDial(arg0 peer.ID, arg1 multiaddr.Multiaddr) bool {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "InterceptAddrDial", arg0, arg1)
@ -59,13 +59,13 @@ func (m *MockConnectionGater) InterceptAddrDial(arg0 peer.ID, arg1 multiaddr.Mul
return ret0
}
// InterceptAddrDial indicates an expected call of InterceptAddrDial
// InterceptAddrDial indicates an expected call of InterceptAddrDial.
func (mr *MockConnectionGaterMockRecorder) InterceptAddrDial(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InterceptAddrDial", reflect.TypeOf((*MockConnectionGater)(nil).InterceptAddrDial), arg0, arg1)
}
// InterceptPeerDial mocks base method
// InterceptPeerDial mocks base method.
func (m *MockConnectionGater) InterceptPeerDial(arg0 peer.ID) bool {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "InterceptPeerDial", arg0)
@ -73,13 +73,13 @@ func (m *MockConnectionGater) InterceptPeerDial(arg0 peer.ID) bool {
return ret0
}
// InterceptPeerDial indicates an expected call of InterceptPeerDial
// InterceptPeerDial indicates an expected call of InterceptPeerDial.
func (mr *MockConnectionGaterMockRecorder) InterceptPeerDial(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InterceptPeerDial", reflect.TypeOf((*MockConnectionGater)(nil).InterceptPeerDial), arg0)
}
// InterceptSecured mocks base method
// InterceptSecured mocks base method.
func (m *MockConnectionGater) InterceptSecured(arg0 network.Direction, arg1 peer.ID, arg2 network.ConnMultiaddrs) bool {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "InterceptSecured", arg0, arg1, arg2)
@ -87,13 +87,13 @@ func (m *MockConnectionGater) InterceptSecured(arg0 network.Direction, arg1 peer
return ret0
}
// InterceptSecured indicates an expected call of InterceptSecured
// InterceptSecured indicates an expected call of InterceptSecured.
func (mr *MockConnectionGaterMockRecorder) InterceptSecured(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InterceptSecured", reflect.TypeOf((*MockConnectionGater)(nil).InterceptSecured), arg0, arg1, arg2)
}
// InterceptUpgraded mocks base method
// InterceptUpgraded mocks base method.
func (m *MockConnectionGater) InterceptUpgraded(arg0 network.Conn) (bool, control.DisconnectReason) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "InterceptUpgraded", arg0)
@ -102,7 +102,7 @@ func (m *MockConnectionGater) InterceptUpgraded(arg0 network.Conn) (bool, contro
return ret0, ret1
}
// InterceptUpgraded indicates an expected call of InterceptUpgraded
// InterceptUpgraded indicates an expected call of InterceptUpgraded.
func (mr *MockConnectionGaterMockRecorder) InterceptUpgraded(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InterceptUpgraded", reflect.TypeOf((*MockConnectionGater)(nil).InterceptUpgraded), arg0)

View File

@ -10,14 +10,13 @@ import (
"github.com/klauspost/compress/zstd"
"github.com/lucas-clemente/quic-go/logging"
"github.com/lucas-clemente/quic-go/metrics"
"github.com/lucas-clemente/quic-go/qlog"
)
var tracer logging.Tracer
func init() {
tracers := []logging.Tracer{metrics.NewTracer()}
tracers := []logging.Tracer{}
if qlogDir := os.Getenv("QLOGDIR"); len(qlogDir) > 0 {
if qlogger := initQlogger(qlogDir); qlogger != nil {
tracers = append(tracers, qlogger)

View File

@ -30,10 +30,10 @@ var log = logging.Logger("quic-transport")
var quicDialContext = quic.DialContext // so we can mock it in tests
var quicConfig = &quic.Config{
MaxIncomingStreams: 1000,
MaxIncomingUniStreams: -1, // disable unidirectional streams
MaxReceiveStreamFlowControlWindow: 10 * (1 << 20), // 10 MB
MaxReceiveConnectionFlowControlWindow: 15 * (1 << 20), // 15 MB
MaxIncomingStreams: 1000,
MaxIncomingUniStreams: -1, // disable unidirectional streams
MaxStreamReceiveWindow: 10 * (1 << 20), // 10 MB
MaxConnectionReceiveWindow: 15 * (1 << 20), // 15 MB
AcceptToken: func(clientAddr net.Addr, _ *quic.Token) bool {
// TODO(#6): require source address validation when under load
return true