I have neighbors that raise Pitbulls. They were always running loose. when we would go for a walk, they would come out and growl and bark at us. Scared the crud out of my family.
I am in rural OK and have a concealed carry permit. I refused to stop walking around my home. I took my Glock along, but my main plan was some pepper spray.
We walked our normal route and the dogs came running out. I doused them with pepper spray in the eyes and nose. They whimpered away. From that day on, they would run out barking, but when they figured out who it was, they would turn around and head back a fair distance.
I think pepper spray is a good measure. It is safer and probably more accurate under stress than a firearm. Also it was, at least for me, effective.