Moved IPNet pointer to concrete type
This commit is contained in:
parent
de4ce9431e
commit
612737e036
@ -18,7 +18,7 @@ type Config struct {
|
|||||||
wgtypes.Config
|
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 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.
|
// 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
|
DNS []net.IP
|
||||||
@ -172,7 +172,7 @@ func parseInterfaceLine(cfg *Config, lhs string, rhs string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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":
|
case "DNS":
|
||||||
for _, addr := range strings.Split(rhs, ",") {
|
for _, addr := range strings.Split(rhs, ",") {
|
||||||
|
2
wg.go
2
wg.go
@ -212,7 +212,7 @@ func SyncAddress(cfg *Config, link netlink.Link, log logrus.FieldLogger) error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if err := netlink.AddrAdd(link, &netlink.Addr{
|
if err := netlink.AddrAdd(link, &netlink.Addr{
|
||||||
IPNet: addr,
|
IPNet: &addr,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
log.WithError(err).Error("cannot add addr")
|
log.WithError(err).Error("cannot add addr")
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user