Script to add all Mullvad servers as Wireguard peers

When I set up Wireguard on OpenWrt, I followed this guide: https://mullvad.net/en/help/running-wireguard-router to the letter. But the part about adding peers manually seemed like a huge pain in the butt, so I looked for a more automatic way to do it.

Every script I found online was obviously "vibe-coded" and about 600 lines of utter nonsense, so I wrote as simple of a script as I could, tested it out (piping to less before I wrote to /etc/config/network, as one should), and finally used it to add every single WireGuard server Mullvad offers as a potential peer.

I'm including the script as a GitHub link as that will make it easier for me to manage changes, if need be. Feedback is always welcome.

3 Likes