Most Helpful Guy
Hey. First, don't feel terrible, just learn from this, accept and understand why you did it and avoid a repeat.
It's good your concerned about hitting someone. Though don't get overly concerned (assuming you've not irrecoverably injured him and that your not totally out of control).
Guy's need to be men. Being hit, whilst to be avoided, is also something a guy should suck up and just deal with when it happens (and if its coming from someone with less strength, they need to prevent further attack but just deal calmly with things). I'm a totally non-violent person, but I'm not ignorant to passion. We all get to a snap point where we want to lash out.
What is going on between both of you? Ask yourself. These feelings don't come from nowhere. Drunkenness simply lowers our inhibitions, causes us to lower our barriers and act more on a surface level (lowers our intelligence). The way you act when your drunk reveals an unresolved set of problems or possibly just takes you back through the darker side of your life.
The fact you wouldn't tell your boyfriend what was wrong shows something has happened between the two of you leading to your natural reaction towards him is to cut him out (e. g. you've been hurt, your natural instinct now is to not let him, e. g. don't let him know what's going on with you). If you love the guy and he's worth it (for you to mull and decide alone or with good friends) then you need to open up to him and get comfortable trusting him again (since it sounds like you've been open with him in the past which lead to you getting seriously hurt, reading between the lines).
Honestly, it is likely that whatever caused you to hit him when drunk is something that you're angry with him for sober, but sober your restraining and directing your anger into more positive actions. Sober you might even understand intellectually. The issue is you haven't delt with it (what ever it is) emotionally. So when your drunk to the point your inhibitions become none-existent your emotions scream and rage and it turns into direct action (especially if he doesn't say the shutdown code.. which is to basically know you well enough to defuse you by saying all the right things. This applies to most people black out drunk with serious emotional hurt).
So, to fix it, you need to re-evaluate yourself, not logically, not intellectually but emotionally. Talk with him (if he's worth it) emotionally, don't let him deflect you with logic. Talk purely of how it feels.