I was walking my mum's dog off-leash on a road, and another dog ran to attack her.
I was surprised by the attack, because the dogs there are normally trained to stay (and bark) on their own property, and never go onto the road.
Anyway, as it was running towards my dog to attack, it ignored me entirely: until I voiced a great big growl: at which it suddenly noticed me for the first time, and stopped. You're bigger than them. You have a right to be on the road. They'd have to be crazy to attack you.
There's a saying (I think they say it about sportsmen):
"It's not the size of the dog in the fight: it's the size of the fight in the dog."
Until I growled the other dog didn't realize that I was anything at all, didn't know I was even a player.
It's not that dogs are cowards necessarily, but consider this: wolves hunt animals larger than themselves: sheep, deer, caribou. But I don't think you'll find them hunting bear (or man).
Someone advised me once, if you ever find yourself alone with wolves in the wild, don't run away in fear: because whether or not you run from them is how they decide whether you are prey. Instead just continue to go about your business, and let them go about theirs.
As for the amount of fight you have in you:
Usually irrelevant. In my personal experience no dog (except puppies) has ever attacked any human, of any size, anywhere (dogs which are likely or able to, are instead restrained by their owners). Any dog which does attack a human is presumably executed, and their owner sanctioned.
However when my dog was under attack, I had a moment to discover how big the fight was in me: and I found it was big enough to say so. In an emergency I'm extremely heavy, and strong enough to lift a dog. We're not that fast, cannot run: but an attack is suicide (unless you're running away, in which case you're no threat).
In the city (in parks and on cycle trails) when off-leash dogs approach me, I slow down to avoid any risk of hitting them (as with children).
Dogs run and bark. That's what they do. Enjoy them.
Replies to comments:
Certainly dogs HAVE attacked (and sometimes killed) humans.
That's in answer to my, "In my personal experience no dog has ever attacked any human".
Conversely, I've heard anecdotes from people who are afraid of dogs.
In fact there was one lady who I met for the first time, and among the first things she and her husband said was that she was afraid of dogs. The next morning all four of us were walking (on a wide footpath in a nature reserve around a lake), more of less line abreast. An unleashed dog showed up on the path ahead, coming towards us, and she ducked behind her husband: at which the damn dog made a bee-line straight for her, frightening her (and so us) more.
I've been attacked by strange dogs on two occasions
I can't tell you what you did wrong or anything. Unleashed K9s, trained attack dogs, might be off-topic.
My main suggestions were only a) don't run b) communicate in a dog-appropriate way: things like, "Oh hello", "Actually I'm just going", "You think I have a problem?", etc.