thanks for using health care magic
Trauma to the testicles is common in people who masturbate and the presentation generally is pain and swellings. This usually gets better after a day or a couple of days. Worse scenario could present with torsion of testes that is extremely painful and requires immediate surgical intervention within the next 6hours.
However, it is also possible and it is likely that you have develop an infection of the testes following the masturbation
that is causing you the swelling. This requires appropriate antibiotics such as chloramphenicol or doxicycline.
It will be necessary to see a doctor for detail evaluation.
Hope this helps you