Not that I've faced this in a long time, but my response (whether I was hurt or not) would simply be "I don't get it." I don't like sharing my emotions like that in person, so this is my solution rather than just telling any friends outright that I was hurt. A plain statement really allows you to see the intent behind what they meant, I feel.
Chances are, they'll most likely kill the rude joke by over-explaining it. They might even find themselves not liking the joke anymore once they've explained why it was supposed to be funny. Believe it or not, there's people that become self-aware like that. You'll have a chance to say how you feel about it, and if they still persist on making that kind of joke around you.. well, that's up to you and how much you're willing to tolerate it.
And if it was an insult, they'll have to elaborate on what they actually meant.. which I imagine would be an uncomfortable position to be in. They'd either have to explain their thoughts and feelings more, or just apologize out of whatever negative feeling got imposed on them. Both situations in this context would give you a chance to let them know that you did feel insulted. It might even open up the opportunity for a calm discussion on what reason they had for feeling the need (or impulse) to insult you.
Or... I guess, you could just ask if that's a joke or insult, and plainly tell them you couldn't tell the difference.. but we don't do that here lol