Files
Quentin McGaw b04529c380 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
2026-03-11 17:16:18 +00:00

26 lines
442 B
Go

package wireguard
import (
"fmt"
"net/netip"
)
func AddAddresses(linkIndex uint32,
addresses []netip.Prefix, ipv6 bool,
netlink NetLinker,
) (err error) {
for _, address := range addresses {
if !ipv6 && address.Addr().Is6() {
continue
}
err = netlink.AddrReplace(linkIndex, address)
if err != nil {
return fmt.Errorf("%w: when adding address %s to link with index %d",
err, address, linkIndex)
}
}
return nil
}