mirror of
https://github.com/qdm12/gluetun.git
synced 2026-05-09 20:29:23 +02:00
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:
@@ -5,15 +5,16 @@ import (
|
||||
"net/netip"
|
||||
)
|
||||
|
||||
func (w *Wireguard) addAddresses(linkIndex uint32,
|
||||
addresses []netip.Prefix,
|
||||
func AddAddresses(linkIndex uint32,
|
||||
addresses []netip.Prefix, ipv6 bool,
|
||||
netlink NetLinker,
|
||||
) (err error) {
|
||||
for _, address := range addresses {
|
||||
if !*w.settings.IPv6 && address.Addr().Is6() {
|
||||
if !ipv6 && address.Addr().Is6() {
|
||||
continue
|
||||
}
|
||||
|
||||
err = w.netlink.AddrReplace(linkIndex, address)
|
||||
err = netlink.AddrReplace(linkIndex, address)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%w: when adding address %s to link with index %d",
|
||||
err, address, linkIndex)
|
||||
|
||||
Reference in New Issue
Block a user