1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
package wire
import (
"bytes"
"encoding/binary"
"log"
"testing"
"github.com/quic-go/quic-go/internal/protocol"
"github.com/quic-go/quic-go/internal/utils"
"github.com/quic-go/quic-go/quicvarint"
)
func encodeVarInt(i uint64) []byte {
return quicvarint.Append(nil, i)
}
func appendVersion(data []byte, v protocol.Version) []byte {
offset := len(data)
data = append(data, []byte{0, 0, 0, 0}...)
binary.BigEndian.PutUint32(data[offset:], uint32(v))
return data
}
func setupLogTest(t *testing.T, buf *bytes.Buffer) utils.Logger {
logger := utils.DefaultLogger
logger.SetLogLevel(utils.LogLevelDebug)
originalOutput := log.Writer()
log.SetOutput(buf)
t.Cleanup(func() { log.SetOutput(originalOutput) })
return logger
}
|