You did something so many people are not able to do, you told the truth. That is one step out of what you did. The goal now is to process what you did and why it happened. Keep in mind you are not married. There was betrayal and it hurt your relationship and your boyfriend and his family. However is there a reason his family needed to know the whole story? this is a private matter between you and he. A question to ask yourself is why did this happen, what about your relationship made you look outside the relationship. Some times we get fearful about commitment and we act out.
The previous member who commented has a great point, "thought's" are what make our mind react the way it does. Just because we think it does not make it accurate or fact. Start thinking about how brave you are to have told the truth, how much integrity it took to come clean and work through this. Don't do this out of guilt though really look in to why this happened and then put it where it belongs, away. It's part of who you are but it's not all you are about. It's one aspect of your life, this other person was in your life for a period of time and it's done. In the past. Cleanse yourself of this as you work through this. If your boyfriend is saying things to make you feel bad about yourself or making comments because he is still hurt he needs to go to counseling with you. The worst is over, the truth is out and hiding a lie such as this is awful and you made the choice to not hide and lie. Please realize how big that decision was and you made it. If you read buy a book on this subject, if you pray doing some talking to whomever you pray to and ask to forgive yourself and ask to get these visions out of your mind. Over time you will. I think you are quite amazing. Good luck.
You said it..'..I cant get it out of my head .'..heres the thing its always our thoughts that make us feel bad, you did a hurtful and silly thing, ,you regret it, you say it was the biggest mistake, we all make mistakes in life, we all do mad ,crazy things, we forgive ourselves and move on, your BF has forgiven you, he wouldnt be there would he.You are making 'progress' so all is well, you love him and if you decide you dont because you continue to think of this other guy you owe it to your BF to set him free. If it only in your thoughts ,it is in your control not to go there and when you do distarct your self .Good Luck