Be careful
Having worked with training dogs for several years, now (Schutzhund Sport, but also know many LEOs and their dogs), Mostly GSDs, Rottweilers(which I personally don't care for) and Malinois, there can be as much danger from acting aggressively towards the dog as there is doing nothing, maybe more. Many breeds are instinctively protective, and will bark, etc. BUT, there's a huge difference between being protective and aggressive...There are very few truly aggressive dogs out there. Tough part is telling the difference...I can do it based on alot of experience, i.e. I can read dogs body language well. Just because a dog runs up and barks at you means nothing, but they are also watching you body language and reaction. Safest course is (and I know this is hardly a "normal" reaction) to stand perfectly still, hands at your sides, doing nothing. If the dog doesn't feel threatened, it is VERY unlikely to bite. If you do something aggressive like pepper spray, or kick the dog, you've now become a threat, and you've got about a 50-50 chance of the dog either running away, or attacking. I have several dogs, who would never bite, despite the fact that they are trained to do so (but only within the narrow confines of their training) UNLESS you attacked them. At that point you are in serious trouble. I've never tried it, but I suspect pepper spray would just probably just pi*s them off... I know that if you struck them, they are gonna fight. (Unfortunately this happened, once. I have a very vocal dog, he loves people and barks to get their attention. When I first moved in this house, I had temporary 4' fence...He climbed over it (pursuing a bitch in heat, that I had here to breed to him...he would never do it on his own due to his training). He, as I would expect went to the first people he found, neighbors working in their yard. And of course he barked, to get their attention. At which point the neighbor (idiot) hit him in the testicles with a rake...And got bit...But, the dog only used enough force (bit the hand) to stop from being attacked, when he could have easily caused serious injury (this is a 125 lb. GSD)...At this point in his life, this dog had been to competing for several years, held many obedience titles, had been around thousands of people (literally), and children could come up to him, pull his ears, his tail, whatever...about as stable as they come.)
Anyway, my point is be careful relying on any means to "stop" a dog, you could escalate an otherwise innocous situation. Being more aware of dog behavior, and how to properly react, is still the best "weapon". Resort to others only when you have no other choice, and realize you might not get the results you want.