use different source and destination connection IDs

This commit is contained in:
Marten Seemann
2018-04-18 17:53:41 +09:00
parent dd5d376d94
commit fae32101a0
12 changed files with 433 additions and 267 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, 8)
b := make([]byte, ConnectionIDLen)
if _, err := rand.Read(b); err != nil {
return nil, err
}

View File

@@ -137,3 +137,9 @@ const MinStreamFrameSize ByteCount = 128
// 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