pass a conn to qtls that returns the remote address

This commit is contained in:
Marten Seemann
2019-03-25 16:59:35 +01:00
parent b2723d6d13
commit da4b3e3176
4 changed files with 37 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"io"
"net"
"unsafe"
"github.com/lucas-clemente/quic-go/internal/protocol"
@@ -112,6 +113,7 @@ func NewCryptoSetupClient(
handshakeStream io.Writer,
oneRTTStream io.Writer,
connID protocol.ConnectionID,
remoteAddr net.Addr,
tp *TransportParameters,
handleParams func([]byte),
tlsConf *tls.Config,
@@ -131,7 +133,7 @@ func NewCryptoSetupClient(
if err != nil {
return nil, nil, err
}
cs.conn = qtls.Client(nil, cs.tlsConf)
cs.conn = qtls.Client(newConn(remoteAddr), cs.tlsConf)
return cs, clientHelloWritten, nil
}
@@ -141,6 +143,7 @@ func NewCryptoSetupServer(
handshakeStream io.Writer,
oneRTTStream io.Writer,
connID protocol.ConnectionID,
remoteAddr net.Addr,
tp *TransportParameters,
handleParams func([]byte),
tlsConf *tls.Config,
@@ -160,7 +163,7 @@ func NewCryptoSetupServer(
if err != nil {
return nil, err
}
cs.conn = qtls.Server(nil, cs.tlsConf)
cs.conn = qtls.Server(newConn(remoteAddr), cs.tlsConf)
return cs, nil
}