From 612737e0366e259223d3467d8560c0f8bf7cd0b2 Mon Sep 17 00:00:00 2001 From: Neven Miculinic Date: Thu, 28 Mar 2019 14:22:30 +0100 Subject: [PATCH] Moved IPNet pointer to concrete type --- config.go | 4 ++-- wg.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config.go b/config.go index afeb4b8..40a514b 100644 --- a/config.go +++ b/config.go @@ -18,7 +18,7 @@ type Config struct { wgtypes.Config // Address list of IP (v4 or v6) addresses (optionally with CIDR masks) to be assigned to the interface. May be specified multiple times. - Address []*net.IPNet + Address []net.IPNet // list of IP (v4 or v6) addresses to be set as the interface’s DNS servers. May be specified multiple times. Upon bringing the interface up, this runs ‘resolvconf -a tun.INTERFACE -m 0 -x‘ and upon bringing it down, this runs ‘resolvconf -d tun.INTERFACE‘. If these particular invocations of resolvconf(8) are undesirable, the PostUp and PostDown keys below may be used instead. DNS []net.IP @@ -172,7 +172,7 @@ func parseInterfaceLine(cfg *Config, lhs string, rhs string) error { if err != nil { return err } - cfg.Address = append(cfg.Address, &net.IPNet{IP: ip, Mask: cidr.Mask}) + cfg.Address = append(cfg.Address, net.IPNet{IP: ip, Mask: cidr.Mask}) } case "DNS": for _, addr := range strings.Split(rhs, ",") { diff --git a/wg.go b/wg.go index a63970c..6585b41 100644 --- a/wg.go +++ b/wg.go @@ -212,7 +212,7 @@ func SyncAddress(cfg *Config, link netlink.Link, log logrus.FieldLogger) error { continue } if err := netlink.AddrAdd(link, &netlink.Addr{ - IPNet: addr, + IPNet: &addr, }); err != nil { log.WithError(err).Error("cannot add addr") return err