Is this a new (or new to you) gun? The rusty colored goopy stuff might be some kind of assembly/storage grease but not necessarily cosmoline. Was the goopy stuff gritty? If there's no grit in there, I would assume its some kind of lubrication and not necessarily indicative of damage.
In any case, if you can't see any damage to the parts (pitting, scaling, etc.) after you clean them up, you should be ok after you give it a good thorough cleaning and lube.