Simple answer:
Buy a Taser, and use it if confronted.
Problem with that is that tasering somebody before he has made a hostile act will get you in serious legal trouble, and once he has made a life-threatening hostile act you have justification for using a regular firearm in response.
Tasers are generally for police, as a tool for subduing uncooperative people for arrest. Private citizens are not generally in such a situation.
A taser isn't going to help you much, if you're confronted by a gang of hostiles, intent on injuring, or even killing you.
You'd best be equipped with something that can stop multiple targets.
Bang bang...