Skip to content

feat(wireguard): amneziawg implementation#3150

Open
Zhurik wants to merge 7 commits intoqdm12:masterfrom
Zhurik:feature-add-amnezia-wg
Open

feat(wireguard): amneziawg implementation#3150
Zhurik wants to merge 7 commits intoqdm12:masterfrom
Zhurik:feature-add-amnezia-wg

Conversation

@Zhurik
Copy link

@Zhurik Zhurik commented Feb 22, 2026

Description


Edit by qdm12

Build it with docker + git at:

docker build -t qmcgaw/gluetun https://github.com/Zhurik/gluetun.git#feature-add-amnezia-wg

And then define parameters in your wireguard config or use new options such as WIREGUARD_J1 (see Dockerfile)


For me this is basically the only working protocol and I saw some issues where people were asking for it

Maybe it would be correct to migrate all wireguard logic to amnezia fork. As far as I understand it's backwards compatible with vanilla wireguard but have some commits behind.

Anyways looking for suggestions!

Issue

#2365

Assertions

  • I am aware that we do not accept manual changes to the servers.json file
  • I am aware that any changes to settings should be reflected in the wiki

@Zhurik
Copy link
Author

Zhurik commented Feb 24, 2026

Related PR in wiki - qdm12/gluetun-wiki#179

Copy link
Owner

@qdm12 qdm12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty good code 💯 Thanks for that!
A good few questions and comments 😉
I'll also later have a look at deduplicating setupUserSpace and setupAmnezia in the internal/wireguard code, although it may not be that possible unfortunately, but I do have some weird Go experience in doing hoops for such things 😄

Also what VPN provider are you using? Any clue what providers built-in Gluetun do support this implementation?

@Zhurik
Copy link
Author

Zhurik commented Feb 25, 2026

The only provider I know is AmneziaWG themselves. I tried with selfhosted version, but more testing needed

@qdm12
Copy link
Owner

qdm12 commented Feb 25, 2026

Oooo interesting, maybe another PR to add them as provider would be cool. I've read apparently also Red Shield VPN and NymVPN support it, but they're not part of Gluetun yet. Out of scope for now 😉
Although we should add a note in the wiki that this is for now only to use with the custom provider, given none support it outside of that, so users aren't tempted to use it and then complain it's broken 😄

@qdm12 qdm12 changed the title Feature add amnezia wg feat(wireguard): amneziawg implementation Feb 25, 2026
@qdm12
Copy link
Owner

qdm12 commented Feb 25, 2026

Maybe it would be correct to migrate all wireguard logic to amnezia fork.

Hmm that's a tough question. I'm very tempted, but also this means we depend on amnaziawg not being evil, miss some commits from wireguard-go, and risk a big issue in case they decide to diverge from wireguard-go in terms of retro-compatibility. I would say let's keep it separate as it is!

@Zhurik
Copy link
Author

Zhurik commented Feb 25, 2026

Although we should add a note in the wiki that this is for now only to use with the custom provider, given none support it outside of that, so users aren't tempted to use it and then complain it's broken 😄

Ok, I'll add that

@Zhurik Zhurik force-pushed the feature-add-amnezia-wg branch from 448ebd2 to 5d029ec Compare February 25, 2026 19:23
@Zhurik
Copy link
Author

Zhurik commented Feb 26, 2026

Refactored some parts so it looks a bit better now

@qdm12
Copy link
Owner

qdm12 commented Feb 27, 2026

ℹ️ apologies but I think the git history was all messed up, possibly due to me force pushing like an idiot on the master branch...

I took the liberty to force push to your branch to fix the history, and rebased it on the tip of the master branch. You can get the changes with

git checkout feature-add-amnezia-wg
git fetch origin
git reset --hard origin/feature-add-amnezia-wg

I also made a backup of the current branch in case you need it let me know!

@Zhurik Zhurik force-pushed the feature-add-amnezia-wg branch from 234be01 to 1a07b0d Compare February 27, 2026 13:32
@Zhurik
Copy link
Author

Zhurik commented Feb 28, 2026

  • split amnezia into their own structs with their own set of methods
  • left validation in one place
  • and other multiple fixes

@Zhurik Zhurik force-pushed the feature-add-amnezia-wg branch from 9d287fe to 2f4e192 Compare March 1, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants