I have been attacked by dogs many times. Never had any serious problem. I will admit that some dogs, especially the "underdogs" of the pack, they seek to prove themselves to the others and they go the extra mile. These aren't the alphas of the pack. These are what i call "the crazy ones". They stick from the rest by showing a lot of teeth and acting like you killed their mom

Most of the time, these crazy idiots are the problem. The rest of the pack usually just follows the alpha and bark at you from a safe distance, trying to shoo you off.
I will tell you what I do in case of a dog attack: First, i do not try to run. That i think is the worst thing you can do. Because it triggers their chasing instinct. What i do is i stop and face them. Yes, that is no joke. That is how i deal with a dog attack. One dog or a pack, it doesn't matter, it is all the same. I stop, put my feet on the ground, take a deffensive stance and do not ever turn my back to the dogs. And most importantly,
"I do not ever crouch or lie down". That is like saying "i am the dinner, come get it". If i am dealing with a pack that surrounded me, i take out my water bottle and use it like a weapon. This might sound funny but dogs actually get scared of it, i think that is because they don't know what it is, and consider it could be a weapon. If they come too close, i put the bike between me and the dogs. As a last resort, i shout at them, hit my foot on the ground and make them understand that i am not playing. What i understood is that dealing with a dog attack requires you to act brave. I believe dogs actually respond to that and they respect you.
PS: If you are carrying a knife, spray, stick, it is a good idea to put it in a place that you can easily reach. I never needed to harm a dog in all my encounters but it could happen, and in that case, using a weapon on a dog is fair game. Yes, i love dogs, but i won't surrender my life to one.