Browse Source

remove peers from interface addresses

Matthew R. Kasun 3 năm trước cách đây
mục cha
commit
5b79af7e51
1 tập tin đã thay đổi với 2 bổ sung5 xóa
  1. 2 5
      netclient/wireguard/mac.go

+ 2 - 5
netclient/wireguard/mac.go

@@ -55,10 +55,6 @@ func WgQuickUpMac(node *models.Node, iface string, confPath string) error {
 		return err
 	}
 	var ips = append(node.AllowedIPs, node.Address, node.Address6)
-	peerIPs := getPeerIPs(realIface)
-	if len(peerIPs) > 0 {
-		ips = append(ips, peerIPs...)
-	}
 	for _, i := range ips {
 		if i != "" {
 			err = addAddress(realIface, i)
@@ -74,7 +70,8 @@ func WgQuickUpMac(node *models.Node, iface string, confPath string) error {
 		logger.Log(1, "error turning on interface ", iface)
 		return err
 	}
-	for _, i := range ips {
+	peerIPs := getPeerIPs(realIface)
+	for _, i := range peerIPs {
 		if i != "" {
 			err = addRoute(i, realIface)
 			if err != nil {