forked from quic-go/quic-go
Merge pull request #1194 from lucas-clemente/log-transport-params
log the TLS Transport Parameters
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/bifurcation/mint"
|
||||
"github.com/bifurcation/mint/syntax"
|
||||
"github.com/lucas-clemente/quic-go/internal/protocol"
|
||||
"github.com/lucas-clemente/quic-go/internal/utils"
|
||||
)
|
||||
|
||||
type extensionHandlerClient struct {
|
||||
@@ -48,6 +49,7 @@ func (h *extensionHandlerClient) Send(hType mint.HandshakeType, el *mint.Extensi
|
||||
return nil
|
||||
}
|
||||
|
||||
utils.Debugf("Sending Transport Parameters: %s", h.ourParams)
|
||||
data, err := syntax.Marshal(clientHelloTransportParameters{
|
||||
InitialVersion: uint32(h.initialVersion),
|
||||
Parameters: h.ourParams.getTransportParameters(),
|
||||
@@ -120,6 +122,7 @@ func (h *extensionHandlerClient) Receive(hType mint.HandshakeType, el *mint.Exte
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
utils.Debugf("Received Transport Parameters: %s", params)
|
||||
h.paramsChan <- *params
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/bifurcation/mint"
|
||||
"github.com/bifurcation/mint/syntax"
|
||||
"github.com/lucas-clemente/quic-go/internal/protocol"
|
||||
"github.com/lucas-clemente/quic-go/internal/utils"
|
||||
)
|
||||
|
||||
type extensionHandlerServer struct {
|
||||
@@ -55,6 +56,7 @@ func (h *extensionHandlerServer) Send(hType mint.HandshakeType, el *mint.Extensi
|
||||
for i, v := range supportedVersions {
|
||||
versions[i] = uint32(v)
|
||||
}
|
||||
utils.Debugf("Sending Transport Parameters: %s", h.ourParams)
|
||||
data, err := syntax.Marshal(encryptedExtensionsTransportParameters{
|
||||
NegotiatedVersion: uint32(h.version),
|
||||
SupportedVersions: versions,
|
||||
@@ -106,6 +108,7 @@ func (h *extensionHandlerServer) Receive(hType mint.HandshakeType, el *mint.Exte
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
utils.Debugf("Received Transport Parameters: %s", params)
|
||||
h.paramsChan <- *params
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -110,6 +110,18 @@ var _ = Describe("Transport Parameters", func() {
|
||||
return list
|
||||
}
|
||||
|
||||
It("has a string representation", func() {
|
||||
p := &TransportParameters{
|
||||
StreamFlowControlWindow: 0x1234,
|
||||
ConnectionFlowControlWindow: 0x4321,
|
||||
MaxBidiStreamID: 1337,
|
||||
MaxUniStreamID: 7331,
|
||||
OmitConnectionID: true,
|
||||
IdleTimeout: 42 * time.Second,
|
||||
}
|
||||
Expect(p.String()).To(Equal("&handshake.TransportParameters{StreamFlowControlWindow: 0x1234, ConnectionFlowControlWindow: 0x4321, MaxBidiStreamID: 1337, MaxUniStreamID: 7331, OmitConnectionID: true, IdleTimeout: 42s}"))
|
||||
})
|
||||
|
||||
Context("parsing", func() {
|
||||
var parameters map[transportParameterID][]byte
|
||||
|
||||
|
||||
@@ -174,3 +174,9 @@ func (p *TransportParameters) getTransportParameters() []transportParameter {
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
// String returns a string representation, intended for logging.
|
||||
// It should only used for IETF QUIC.
|
||||
func (p *TransportParameters) String() string {
|
||||
return fmt.Sprintf("&handshake.TransportParameters{StreamFlowControlWindow: %#x, ConnectionFlowControlWindow: %#x, MaxBidiStreamID: %d, MaxUniStreamID: %d, OmitConnectionID: %t, IdleTimeout: %s}", p.StreamFlowControlWindow, p.ConnectionFlowControlWindow, p.MaxBidiStreamID, p.MaxUniStreamID, p.OmitConnectionID, p.IdleTimeout)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user