code: func ParsePacket(data []byte, shortHeaderConnIDLen int) (*Header, []byte /* packet data */, []byte /* rest */, error) {
  	hdr, err := parseHeader(bytes.NewReader(data), shortHeaderConnIDLen)
  	if err != nil {
  		if err == errUnsupportedVersion {
  			return hdr, nil, nil, nil
  		}
  		return nil, nil, nil, err
  	}
  	var rest []byte
  	if hdr.IsLongHeader {
  		if protocol.ByteCount(len(data)) < hdr.ParsedLen()+hdr.Length {
  			return nil, nil, nil, fmt.Errorf("packet length (%d bytes) is smaller than the expected length (%d bytes)", len(data)-int(hdr.ParsedLen()), hdr.Length)
  		}
  		packetLen := int(hdr.ParsedLen() + hdr.Length)
  		rest = data[packetLen:]
  		data = data[:packetLen]
  	}
  	return hdr, data, rest, nil
  }
docs: // ParsePacket parses a packet.
  // If the packet has a long header, the packet is cut according to the length field.
  // If we understand the version, the packet is header up unto the packet number.
  // Otherwise, only the invariant part of the header is parsed.