mirror of
				https://github.com/gravitl/netmaker.git
				synced 2025-11-01 04:32:40 +08:00 
			
		
		
		
	refactor + bugs
This commit is contained in:
		| @@ -144,6 +144,9 @@ func JoinNetwork(cfg *config.ClientConfig, privateKey string) error { | ||||
| 		return fmt.Errorf("error decoding node from server %w %s", err, string(bodybytes)) | ||||
| 	} | ||||
| 	node := nodeGET.Node | ||||
| 	if nodeGET.Peers == nil { | ||||
| 		nodeGET.Peers = []wgtypes.PeerConfig{} | ||||
| 	} | ||||
| 	// safety check. If returned node from server is local, but not currently configured as local, set to local addr | ||||
| 	if cfg.Node.IsLocal != "yes" && node.IsLocal == "yes" && node.LocalRange != "" { | ||||
| 		node.LocalAddress, err = ncutils.GetLocalIP(node.LocalRange) | ||||
|   | ||||
| @@ -15,6 +15,7 @@ import ( | ||||
| 	"github.com/gravitl/netmaker/netclient/local" | ||||
| 	"github.com/gravitl/netmaker/netclient/ncutils" | ||||
| 	"github.com/gravitl/netmaker/netclient/wireguard" | ||||
| 	"golang.zx2c4.com/wireguard/wgctrl/wgtypes" | ||||
| 	//homedir "github.com/mitchellh/go-homedir" | ||||
| ) | ||||
|  | ||||
| @@ -53,6 +54,10 @@ func Pull(network string, iface bool) (*models.Node, error) { | ||||
| 	resNode := nodeGET.Node | ||||
| 	// ensure that the OS never changes | ||||
| 	resNode.OS = runtime.GOOS | ||||
| 	if nodeGET.Peers == nil { | ||||
| 		nodeGET.Peers = []wgtypes.PeerConfig{} | ||||
| 	} | ||||
|  | ||||
| 	if iface { | ||||
| 		if err = config.ModConfig(&resNode); err != nil { | ||||
| 			return nil, err | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 0xdcarns
					0xdcarns