I deal with them directly. First instance I tell the owner that I will kill their dog if it is on or near ever again. A dog running down the street and jumping on me is not “just being friendly” it’s obnoxious and unacceptable. I tell the owner their dog WILL die.
It’s worked so far.
What if the owner isn’t there?
What if you have no idea who owns the dog, and you’ve never seen the dog before?
Shooting isn’t the answer unless you wish to risk a long stay in prison, in most cities.
Best is to learn how to actually maintain the upper hand with any dog, any place.