MCPcopy Create free account
hub / github.com/HyBuildNet/quic-relay / parseALPN

Function parseALPN

internal/proxy/parser.go:823–843  ·  view source on GitHub ↗

parseALPN extracts protocol names from ALPN extension.

(data []byte)

Source from the content-addressed store, hash-verified

821
822// parseALPN extracts protocol names from ALPN extension.
823func parseALPN(data []byte) []string {
824 if len(data) < 2 {
825 return nil
826 }
827
828 // List length (2 bytes)
829 offset := 2
830 var protocols []string
831
832 for offset < len(data) {
833 protoLen := int(data[offset])
834 offset++
835 if offset+protoLen > len(data) {
836 break
837 }
838 protocols = append(protocols, string(data[offset:offset+protoLen]))
839 offset += protoLen
840 }
841
842 return protocols
843}
844
845// readVarInt reads a QUIC variable-length integer.
846func readVarInt(data []byte) (uint64, int, error) {

Callers 1

parseTLSClientHelloFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected