When I was a boy and had a paper route (the really old days) I used to carry two things with me for aggressive dogs: a squirt gun filled with ammonia and water and an 18” chunk of an old axe handle (solid, yes really solid ash). The squirt gun was for the little nippers that would nip as I rode by. A good squirt in the face and they would stop at the property line after that. For those big dogs (with what I call a Progressive attitude) a solid whack on the snout (and I would make sure I could get a good whack just as they were ready to bite) was reserved for the others. There is nothing more painful and instructive than a whack on the nose of a dog. 95% of dogs I never had a problem with but the others pretty well mirrored their masters. Please note that in either case were the dogs permanently harmed (police officers might take note).
When the dog charges, begin the squirts from a good distance as it takes a couple of seconds for the mixture to take effect. You should make sure to get a couple of shots on the fur coat as well, since the pepper oils will spread out over a large area and not diffuse easily even if licked constantly. If it is a particularly vicious animal that has bitten you before, it would be quite painful if some of the squirts splashed its backside as it tried to duck. The oils would spread to some quite sensitive local areas afterwards... Not that I would intentionally do that to the Cow that bit Me severely enough when I was younger that it placed crushed indentations in a couple of bones easily seen on the x-ray pics later.