lib/connections: Update quic (#6591)
* lib/connections: Update quic * Fix freebsd builds? * Undo x/sys and gopsutil update * Update quic_dial.go * Update quic_listen.go
This commit is contained in:
@@ -80,7 +80,7 @@ func (d *quicDialer) Dial(ctx context.Context, _ protocol.DeviceID, uri *url.URL
|
||||
stream, err := session.OpenStreamSync(ctx)
|
||||
if err != nil {
|
||||
// It's ok to close these, this does not close the underlying packetConn.
|
||||
_ = session.Close()
|
||||
_ = session.CloseWithError(1, err.Error())
|
||||
if createdConn != nil {
|
||||
_ = createdConn.Close()
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ func (t *quicListener) serve(ctx context.Context) error {
|
||||
cancel()
|
||||
if err != nil {
|
||||
l.Debugf("failed to accept stream from %s: %v", session.RemoteAddr(), err)
|
||||
_ = session.Close()
|
||||
_ = session.CloseWithError(1, err.Error())
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
package connections
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"net"
|
||||
|
||||
"github.com/lucas-clemente/quic-go"
|
||||
@@ -30,7 +31,7 @@ type quicTlsConn struct {
|
||||
|
||||
func (q *quicTlsConn) Close() error {
|
||||
sterr := q.Stream.Close()
|
||||
seerr := q.Session.Close()
|
||||
seerr := q.Session.CloseWithError(0, "closing")
|
||||
var pcerr error
|
||||
if q.createdConn != nil {
|
||||
pcerr = q.createdConn.Close()
|
||||
@@ -44,6 +45,24 @@ func (q *quicTlsConn) Close() error {
|
||||
return pcerr
|
||||
}
|
||||
|
||||
func (q *quicTlsConn) ConnectionState() tls.ConnectionState {
|
||||
qcs := q.Session.ConnectionState()
|
||||
return tls.ConnectionState{
|
||||
Version: qcs.Version,
|
||||
HandshakeComplete: qcs.HandshakeComplete,
|
||||
DidResume: qcs.DidResume,
|
||||
CipherSuite: qcs.CipherSuite,
|
||||
NegotiatedProtocol: qcs.NegotiatedProtocol,
|
||||
NegotiatedProtocolIsMutual: qcs.NegotiatedProtocolIsMutual,
|
||||
ServerName: qcs.ServerName,
|
||||
PeerCertificates: qcs.PeerCertificates,
|
||||
VerifiedChains: qcs.VerifiedChains,
|
||||
SignedCertificateTimestamps: qcs.SignedCertificateTimestamps,
|
||||
OCSPResponse: qcs.OCSPResponse,
|
||||
TLSUnique: qcs.TLSUnique,
|
||||
}
|
||||
}
|
||||
|
||||
// Sort available packet connections by ip address, preferring unspecified local address.
|
||||
func packetConnLess(i interface{}, j interface{}) bool {
|
||||
iIsUnspecified := false
|
||||
|
||||
Reference in New Issue
Block a user