Ok, first off, a lot depends upon all the potential laws in your state & local jurisdiction.
As noted above,, there are some non-lethal deterrents that could be used,, such as bear spray. DO NOT USE WASP & HORNET SPRAY! It can cause serious injury to a dog,, and you could be sued for animal cruelty.
And the old "Three S's" can be used against you. Often,, there are unseen or hidden cameras in places you could be seen on, and they will be used against you.
Honesty is the best policy.
If the local & state laws allow for self defense,, by all means KNOW THE LAW.
And just like being involved in a shooting where people get shot,, often,, it's best to have a lawyer answer for you.
I got charged with "Cruelty to Animals" here in NC about 40 years ago. Local neighbors failed to keep their dogs on their property. After repeated calls to Animal Control, and no action by them, (they admitted to that in court) my mother which was the complainant, told me to "Burn their butts & shoot them" when on our property. I lived there on the property. I caught (6) different dogs on our property,, and using a milder, less than lethal special load,, I popped (5) of them easily, and they all were fine. Number six,, I happened to accidentally use a second round that was a potentially lethal round. Result, serious wounding of that dog.
I got arrested, and charged.
In court, a lot of serious facts got brought out about the owners, their actions, and such. That, and good testimony by (2) different LEO agencies. But the saving grace,, was a NC law that stated; "The owner of a dog is responsible for the dogs actions when the dog is not on their property." By allowing the dogs to roam free, failure to control them, and citing a public nuisance & health issues, (feces on our property,) I was acquitted.
I now own a small business. I'm a State Certified Animal Damage Control Agent.
I also go to a lot of different places. I meet all kinds of dogs. One thing I carry is a simple stun gun. It has the metal contact probes,, and it crackles electricity between the posts & makes the right kind of sound that will most often STOP a charging dog. And if it doesn't stop one,, and it makes it to me,, I will "tazer" it with the stun gun. Non-lethal, and very effective. So far,, I've never had to actually hit a dog with the contact probes.
But the best policy is to be honest,, and be prepared for potential legal issues,, even if you are on the right side of the law.