forked from quic-go/quic-go
add handshake message logging
This commit is contained in:
@@ -73,6 +73,8 @@ func (h *CryptoSetup) HandleCryptoStream() error {
|
||||
}
|
||||
chloData := cachingReader.Get()
|
||||
|
||||
utils.Infof("Got crypto message:\n%s", printHandshakeMessage(cryptoData))
|
||||
|
||||
var reply []byte
|
||||
if !h.isInchoateCHLO(cryptoData) {
|
||||
// We have a CHLO with a proper server config ID, do a 0-RTT handshake
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"sort"
|
||||
|
||||
@@ -86,3 +87,20 @@ func WriteHandshakeMessage(b *bytes.Buffer, messageTag Tag, data map[Tag][]byte)
|
||||
// Now we write the index data for real
|
||||
copy(b.Bytes()[indexStart:], indexData)
|
||||
}
|
||||
|
||||
func printHandshakeMessage(data map[Tag][]byte) string {
|
||||
var res string
|
||||
for k, v := range data {
|
||||
if k == TagPAD {
|
||||
continue
|
||||
}
|
||||
res += fmt.Sprintf("\t%s: %#v\n", tagToString(k), string(v))
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func tagToString(tag Tag) string {
|
||||
b := make([]byte, 4)
|
||||
binary.LittleEndian.PutUint32(b, uint32(tag))
|
||||
return string(b)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user