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:
Audrius Butkevicius
2020-05-01 08:14:28 +01:00
committed by GitHub
parent bdb25f9ba5
commit ac7338f1f2
5 changed files with 203 additions and 16 deletions
+20 -1
View File
@@ -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