This happened to me a few weeks ago.
It's easy to say "don't run", but when it is coming for you, there is a split second when you realize it is not going to stop. I ended up fending him off with the package, and simultaneously jumped up on a 3 foot wall as he was biting at me. Then he jumped up on the wall, so I jumped down and dove onto the customers car hood. I used the package ( a small white box about the size of a steering wheel), and kept him from getting on the hood. The owner comes out and the first thing he says is, "You're denting my car". I told him to get his dog (using other words). He just stood there for 20 seconds pretending nothing was happening until he finally got his dog.
I can no longer deliver to this house if the garage door is open. Otherwise, it is back to normal. We have older carriers, carriers not as active or nimble as I am, who could not have jumped on the wall or car. Would they have been attacked severely? It was a mid-sized pit-bull type of dog, mean and ferocious. Management just had him (dog owner) come in and sign something to get service back. Dogs are no joke. You think you know everything about your route until the unexpected happens, which could be at any time, anywhere.