Hang in there you're not a failure
I didn't have mastitis, but I had terrible cracked bleeding nipples, and a few blocked ducts.

Like Jennifer13 said I found the anti inflammatories helped with the pain, a warm shower was great, but I had to keep the water off my nipples as it hurt if the stream hit directly on them, but running over was good.
I feel for you I remember the pain it's not nice!!! I was in tears at times but and terrified when DS woke for a feed, it was a feeling of dread, but I pushed through and it's all good now. You're not a failure at all and you're not the only one

In my case the nipples and latch problem were because DS had a sore neck, 2 chiropractic treatments and it was all fixed.

Good luck let us know how you go.