You write clearly that you recognize that distress, pain and boredom bring you into lust behaviors like porn searches and masturbating yourself. Sure there is a habit aspect, but you see more to it, b"H.
Therefore, being dilligent and avoiding those things (with kedusah and shmiras ha'eynayim) will not solve your problem: difficulty facing real life without medicating yourself. Would you to perfectly succeed at staying clean - you'd now be just more miserable...and like many here, you'd blame G-d, the yetzer hora, joggers, the internet, or your mother (all the same as blaming Hashem, for they are all part of His Will). So, 'hold on!' is not the answer for you.
On the other hand, using those drugs will certainly keep you in a sick cycle and will prevent clear thinking and real healing. So you probably have no choice but to stop, no matter what mental, religious, psychological improvements you undertake successfully be"H.
So, I guess you will need to daven for help and take whatever steps needed in order to avoid feeding your lust by any use of your eyes, mind, or penis for things they were not made for: fantasy, self-pleasuring, and escape from reality. And at the same time, you will need to start to learn how to face real life with a little bit more trust and confidence in G-d and in yourself.
Rather a tall order - especially since you have undoubtedly been trying all these things as hard as you can, for some years already! And given that your own mind is supervising, this will be hampered by twisted thinking that you cannot recognize. As Chaza"l put it, ein chavush matir es atzmo mibeis ha'asurim.
So keep sharing here and with all safe people in recovery, giving the details of whats going on with you today, each day, and grow, grow, grow! You will stay imperfect, I guarantee it - it's all about real, patient growth as opposed to fake, expedient perfection.
I suggest starting to journal your thoughts and feelings - not on the computer and not on GYE, but in your own handwriting on paper.
This is a huge step for you already!
Hatzlocha!
Dov