You shouldn't feel guilty for looking at solutions. Your struggle is something that lots of people, including myself, share. The truth is that no one is able to solve all problems they are ever given on their own, because often, the problems might involve a new idea you've never seen before, or a technique you wouldn't have thought of, and these are things that you have to pick up along the way and cannot be expected to invent on your own.
My advice is this. When you're trying a problem, write everything down. Don't be afraid to waste paper scribbling down notes which don't help towards solving it. Very often, the solution to a problem might be easy once you've written your progress down, but the problem might seem completely opaque if you haven't even dared to try anything. So, keep trying, and keep writing down whatever little progress you have made. This should give you a sense of what exactly is hard about the problem, and what exactly is the hurdle you can't get over.
After you've been trying the problem for a certain time $P$, if you're still getting nowhere, it is fine to look at the solution. But after doing so, close the textbook or browser and just try to work through the whole proof yourself, without reference. This process of writing everything down will make the logic "flow" and seem natural to you, and ensure that you really understand what the proof is. It is imperative that you've tried the problem before this, because then, you gain a lot through finding out how exactly the thing that was stopping you from solving the problem is overcome in the actual solution. This is how you learn and gain new insights to improve your skills.
For me, I've found that this time $P$ which works best is around $30$ minutes for routine homework-style problems, but this time might vary for you. Try this out and find the best time that works for yourself.