Hi there ~
It seems like you have an infected cyst
that burst letting out the pus and healing by itself. I also wonder if you have had these problems for a long time. If you did it might be good to see a gynecologist to get yourself investigated for any sexually transmitted diseases, and at least for an examination. I hope this helps.
Take care and have a lovely day!