I have had two dogs attach ME in my life.
One took exception to me patting him while he was eating (I was 7 years old at the time). He turned and bit me in the mouth requiring 17 stitches. The owner (friend) was going to put him down but I cried and said no, feeling it must have been my fault which it was.
Second time, only a few years ago, I was walking thru the campus where I lived on my way to work, when a wild dog started stalking me from behind. I tried to keep calm. He probably smelt breakfast on me

. Anyhows, shortly there were three dogs following me and I starting feeling really concerned. When they were no more than 3 metres away from I truned and tried to scare them. Well that didnt work!

Two charged me. I decided it was me or them so I prepared for a good kick in the mouth (sort of getting my own back). As the first one got real close i gave it what for, and kicked it right in the jaw. It backed off with a howl and the others backed off too. I was sweating and shaking for the rest of the day.
So back to your experience. Since my experience recently I have thought, would a spray like mace get you in trouble with an owner/the law if you used this to protect yourself while out walking? Is it even legal to carry the stuff these days?
I dont want to hurt any dog, but if it comes down to me or my family vs an angry dog.....