implement parsing of headers with different connection ID lengths

This commit is contained in:
Marten Seemann
2018-07-01 12:15:15 +07:00
parent b26eb2705f
commit 0bd7e744ff
16 changed files with 97 additions and 90 deletions

View File

@@ -12,7 +12,7 @@ type ConnectionID []byte
// GenerateConnectionID generates a connection ID using cryptographic random
func GenerateConnectionID() (ConnectionID, error) {
b := make([]byte, ConnectionIDLen)
b := make([]byte, ConnectionIDLenGQUIC)
if _, err := rand.Read(b); err != nil {
return nil, err
}

View File

@@ -82,3 +82,9 @@ const MinInitialPacketSize = 1200
// * one failure due to an incorrect or missing source-address token
// * one failure due the server's certificate chain being unavailable and the server being unwilling to send it without a valid source-address token
const MaxClientHellos = 3
// ConnectionIDLenGQUIC is the length of the source Connection ID used on gQUIC QUIC packets.
const ConnectionIDLenGQUIC = 8
// MinConnectionIDLenInitial is the minimum length of the destination connection ID on an Initial packet.
const MinConnectionIDLenInitial = 8

View File

@@ -145,12 +145,3 @@ const MaxAckFrameSize ByteCount = 1000
// If the packet packing frequency is higher, multiple packets might be sent at once.
// Example: For a packet pacing delay of 20 microseconds, we would send 5 packets at once, wait for 100 microseconds, and so forth.
const MinPacingDelay time.Duration = 100 * time.Microsecond
// ConnectionIDLen is the length of the source Connection ID used on IETF QUIC packets.
// The Short Header contains the connection ID, but not the length,
// so we need to know this value in advance (or encode it into the connection ID).
// TODO: make this configurable
const ConnectionIDLen = 8
// MinConnectionIDLenInitial is the minimum length of the destination connection ID on an Initial packet.
const MinConnectionIDLenInitial = 8