code: func validateCONNACKBytes(fixedHeader FixedHeader, variableHeader []byte) error {
  	// Extract the MQTT Control Packet type.
  	ptype, err := fixedHeader.ptype()
  	if err != nil {
  		return err
  	}
  
  	// Check the length of the fixed header.
  	if len(fixedHeader) != lenCONNACKFixedHeader {
  		return ErrInvalidFixedHeaderLen
  	}
  
  	// Check the MQTT Control Packet type.
  	if ptype != TypeCONNACK {
  		return ErrInvalidPacketType
  	}
  
  	// Check the reserved bits of the fixed header.
  	if fixedHeader[0]<<4 != 0x00 {
  		return ErrInvalidFixedHeader
  	}
  
  	// Check the Remaining Length of the fixed header.
  	if fixedHeader[1] != lenCONNACKVariableHeader {
  		return ErrInvalidRemainingLength
  	}
  
  	// Check the length of the variable header.
  	if len(variableHeader) != lenCONNACKVariableHeader {
  		return ErrInvalidVariableHeaderLen
  	}
  
  	// Check the reserved bits of the variable header.
  	if variableHeader[0]>>1 != 0x00 {
  		return ErrInvalidVariableHeader
  	}
  
  	// Check the Connect Return code of the variable header.
  	switch variableHeader[1] {
  	case
  		connRetAccepted,
  		connRetUnacceptableProtocolVersion,
  		connRetIdentifierRejected,
  		connRetServerUnavailable,
  		connRetBadUserNameOrPassword,
  		connRetNotAuthorized:
  	default:
  		return ErrInvalidConnectReturnCode
  	}
  
  	return nil
  }
docs: // validateCONNACKBytes validates the fixed header and the variable header.