chore!(amneziawg): refactor to be separate from wireguard

- amneziawg is now a VPN protocol and no longer a Wireguard implementation
- Use it with VPN_TYPE=amneziawg
- document AMNEZIAWG_* options in Dockerfile
- document amneziawg support in readme
- separate amneziawg settings and code from wireguard
- re-use code from wireguard whenever possible
This commit is contained in:
Quentin McGaw
2026-03-11 16:35:18 +00:00
parent efea169495
commit b04529c380
54 changed files with 1608 additions and 741 deletions
+9 -2
View File
@@ -33,14 +33,21 @@ func (l *Loop) Run(ctx context.Context, done chan<- struct{}) {
var connection models.Connection
var err error
subLogger := l.logger.New(log.SetComponent(settings.Type))
if settings.Type == vpn.OpenVPN {
switch settings.Type {
case vpn.AmneziaWg:
vpnInterface = settings.AmneziaWg.Wireguard.Interface
vpnRunner, connection, err = setupAmneziaWg(ctx, l.netLinker, l.fw,
providerConf, settings, l.ipv6Supported, subLogger)
case vpn.OpenVPN:
vpnInterface = settings.OpenVPN.Interface
vpnRunner, connection, err = setupOpenVPN(ctx, l.fw,
l.openvpnConf, providerConf, settings, l.ipv6Supported, l.cmder, subLogger)
} else { // Wireguard
case vpn.Wireguard:
vpnInterface = settings.Wireguard.Interface
vpnRunner, connection, err = setupWireguard(ctx, l.netLinker, l.fw,
providerConf, settings, l.ipv6Supported, subLogger)
default:
panic("vpn type not implemented: " + settings.Type)
}
if err != nil {
l.crashed(ctx, err)