Since getting attacked by a dog is a possible thing, I;ve always thought what I would do. IDK if I"d be able to draw and open my knife in time (assuming no CCW). But even with CCW, and it takes on a slow day 1.2 seconds to draw and fire 1 shot, what it that's not enough time. I wonder if rushing the dog to close the distance and doing a foodball style spin move would work against the dogs initial leap to bite. I mean, human nature would have one stick out your arm or hand, but the dog will bite that. So, remove that from the equation and there's less surface area for the dog to bite. Just gotta watch out for your neck, bit it's a much smaller target, so see spin move.
Then vid's of people I've seen attacked by dogs, after the initial leap/bite, they give up. So is going ape shit from the get go the way? LET"S GET IT ON (In Joe's voice from Family Guy).
I used to ride my bicycle everywhere growing up, and dogs chasing me and being aggressive was very common.
Usually they chase you if you run or try to ride off, so the first thing is stop and stand your ground. They usually pause since they weren't expecting that. their intent usually is to chase you away, not get into a fight.
These few who do want to continue usually get scared away if you throw a couple of rocks in their direction. Commanding them with words they might know like "No!" and "Heel!" can work, because they are thinking you might be someone they need to obey. Your words are familiar, which makes you less of a stranger.
The only dogs i'd be instantly in self-defense mode against would be a pit bull, especially if more than one. They aren't like most breeds. Once they decide to attack, they go all out to get you, and once latched on will refuse to let go.
If you're on a bike, get off and keep it between you and the dog/s. If you have anything you can use as cover, use it. Don't show fear no matter how nervous you are. I've had dogs run at me, and by standing still and talking to them calmly, they actually came up to me to be petted. A calming voice can set them at ease and stop the aggression.
You are envisioning the worst case scenario where you need to stop a charging man eater. In my experience, that's a rare case. A little understanding of animal behavior and how to communicate to them to show you are not afraid while also not a threat works most times.
If you stand still, don't act afraid, and then slowly walk away, that'll break their focus on you more often than not.