I wouldn't bother with an air horn. Most dogs will retreat if you hell at them in a stern and loud voice. Or they'll at least retreat long enough to buy you a bit more time to get away or dismount and shield yourself with your bike. Shouting and a squirt of water from a water bottle (carry one for just this purpose since you use a Camelback) will usually do the trick, at least in my experience.
Now dogs that ambush you are simply tough to deal with. I've had some come pretty darn close. All I could really do in that adrenaline rush was yell and sprint. I'm not sure I'd have the presence to grab anything, even if it was easy to reach.
Live with intention. Walk to the edge. Listen hard. Practice wellness. Play with abandon. Laugh. Choose with no regret. Continue to learn. Appreciate your friends. Do what you love. Live as if this is all there is.
--Mary Anne Radmacher