Sometimes I just outrun dogs, even just peddling if i'm going downhill. but mostly i see them coming and get off and walk with the bike between me and them, and say "Good boy!" Usually they totally change their attitude and are happy to see someone. If they continue to be "mean", i grab my black golf umbrella, (which is kind of big but one of my most important pieces of gear), which so far has scared away even a gang of dogs. Mainly having a big umbrella has allowed me to make a run for it even when severe hailstorms are coming, and usually I make it to a gas station, coffee shop, abandoned building, and if not can sit on my pack with the umbrella. Not pleasant, but usually brief.