From 7b211d65746c98377ba64bb5f2d3a93fefc0439e Mon Sep 17 00:00:00 2001 From: Stojan Dimitrovski Date: Sun, 13 Nov 2022 16:46:29 +0100 Subject: [PATCH] expose function to convert byte slice to a connection ID (#3614) --- interface.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/interface.go b/interface.go index 1b59d0e22..78c731e21 100644 --- a/interface.go +++ b/interface.go @@ -206,6 +206,12 @@ type EarlyConnection interface { // as they are allowed by RFC 8999. type ConnectionID = protocol.ConnectionID +// ConnectionIDFromBytes interprets b as a Connection ID. It panics if b is +// longer than 20 bytes. +func ConnectionIDFromBytes(b []byte) ConnectionID { + return protocol.ParseConnectionID(b) +} + // A ConnectionIDGenerator is an interface that allows clients to implement their own format // for the Connection IDs that servers/clients use as SrcConnectionID in QUIC packets. //