mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-10 04:48:50 +03:00
1201492222
* Updated lucas-clemente/quic-go for QUIC 39+ support * Update quic-go to latest
18 lines
405 B
Go
18 lines
405 B
Go
package utils
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"encoding/binary"
|
|
|
|
"github.com/lucas-clemente/quic-go/internal/protocol"
|
|
)
|
|
|
|
// GenerateConnectionID generates a connection ID using cryptographic random
|
|
func GenerateConnectionID() (protocol.ConnectionID, error) {
|
|
b := make([]byte, 8)
|
|
_, err := rand.Read(b)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
return protocol.ConnectionID(binary.LittleEndian.Uint64(b)), nil
|
|
}
|