I have a suggestion which might seem odd...
I recommend a YouTuber called Elliott Hulse. While his area of expertise is in physical activity, he also takes great interest in how the mind and body are linked. As you have experienced your own confidence before, you will probably understand where I'm going with this.
When you were confident, you probably didn't feel that in your head. You weren't consciously trying to be confident. It was just a feeling in your "body", so it makes sense to target your "body" rather than your conscious mind.
When I say "body", I am referring to your subconscious mind, your heart, your spirit, whatever you want to call it.
What I suggest is:
1. Use a guided meditation recording to calm yourself once per day. There are some OK ones on YouTube. This stops you thinking with your head so much. Don't resist it, or it will be ineffective. Even if it doesn't work, no harm done, eh?
2. Learn to use your body for something worthwhile (I suggest weight training, but it can be anything which teaches full body control)
3. Through your activity, learn how you can control your body, so that you become more aware of it. This is why I wouldn't recommend just running, or anything which only involves repetition and and not so much body-awareness.
As you develop mind-muscle connections and feel completely in control of your body, you will find that your confidence will emerge again.
Here is the part which I must stress the most:
Dedicate yourself to the activity. Let it become more important to you than the opinions of other people. It is your skill. You are helping yourself. You have nothing to be ashamed of by giving it your all.
If you do this, you will gain respect from others and yourself, because you will have achieved something which most people never do. I don't even need to tell you where to go from there, because you'll know instinctively.
Just gonna throw in a reminder to look up Elliott Hulse. He's seriously helpful, although somewhat strange...
Personal experience (I used powerlifting to get myself out of a similar state of mind to yours)