mirror of
				https://github.com/gravitl/netmaker.git
				synced 2025-10-31 20:22:44 +08:00 
			
		
		
		
	fixing netclient
This commit is contained in:
		| @@ -36,6 +36,7 @@ type NodeConfig struct { | |||||||
|         DNSOff bool `yaml:"dnsoff"` |         DNSOff bool `yaml:"dnsoff"` | ||||||
|         IsLocal bool `yaml:"islocal"` |         IsLocal bool `yaml:"islocal"` | ||||||
|         IsDualStack bool `yaml:"isdualstack"` |         IsDualStack bool `yaml:"isdualstack"` | ||||||
|  |         IsIngressGateway bool `yaml:"isingressgateway"` | ||||||
|         AllowedIPs string `yaml:"allowedips"` |         AllowedIPs string `yaml:"allowedips"` | ||||||
|         LocalRange string `yaml:"localrange"` |         LocalRange string `yaml:"localrange"` | ||||||
|         PostUp string `yaml:"postup"` |         PostUp string `yaml:"postup"` | ||||||
|   | |||||||
| @@ -423,6 +423,7 @@ func Install(accesskey string, password string, server string, network string, n | |||||||
|        fmt.Println("     Mac Address: " + node.Macaddress) |        fmt.Println("     Mac Address: " + node.Macaddress) | ||||||
|        fmt.Println("     Is Local?: " + strconv.FormatBool(node.Islocal)) |        fmt.Println("     Is Local?: " + strconv.FormatBool(node.Islocal)) | ||||||
|        fmt.Println("     Is Dual Stack?: " + strconv.FormatBool(node.Isdualstack)) |        fmt.Println("     Is Dual Stack?: " + strconv.FormatBool(node.Isdualstack)) | ||||||
|  |        fmt.Println("     Is Ingress Gateway?: " + strconv.FormatBool(node.Isingressgateway)) | ||||||
|        fmt.Println("     Local Range: " + node.Localrange) |        fmt.Println("     Local Range: " + node.Localrange) | ||||||
|  |  | ||||||
|        if node.Dnsoff==true && !nodecfg.DNSOff { |        if node.Dnsoff==true && !nodecfg.DNSOff { | ||||||
| @@ -610,7 +611,7 @@ func modConfig(node *nodepb.Node) error{ | |||||||
|         if node.Isdualstack == true { |         if node.Isdualstack == true { | ||||||
|                 nodecfg.IsDualStack = true |                 nodecfg.IsDualStack = true | ||||||
|         } |         } | ||||||
|  |         nodecfg.IsIngressGateway = node.Isingressgateway | ||||||
|         if node.Localrange != "" && node.Islocal { |         if node.Localrange != "" && node.Islocal { | ||||||
|                 nodecfg.IsLocal = true |                 nodecfg.IsLocal = true | ||||||
|                 nodecfg.LocalRange = node.Localrange |                 nodecfg.LocalRange = node.Localrange | ||||||
| @@ -1310,6 +1311,7 @@ func getNode(network string) nodepb.Node { | |||||||
| 	node.Password = nodecfg.Password | 	node.Password = nodecfg.Password | ||||||
| 	node.Dnsoff = nodecfg.DNSOff | 	node.Dnsoff = nodecfg.DNSOff | ||||||
| 	node.Isdualstack = nodecfg.IsDualStack | 	node.Isdualstack = nodecfg.IsDualStack | ||||||
|  | 	node.Isingressgateway = nodecfg.IsIngressGateway | ||||||
|         return node |         return node | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -171,12 +171,6 @@ func getExtPeers(macaddress string, network string, server string, dualstack boo | |||||||
|                 log.Fatalf("Issue retrieving config for network: " + network +  ". Please investigate: %v", err) |                 log.Fatalf("Issue retrieving config for network: " + network +  ". Please investigate: %v", err) | ||||||
|         } |         } | ||||||
|         nodecfg := cfg.Node |         nodecfg := cfg.Node | ||||||
|         keepalive := nodecfg.KeepAlive |  | ||||||
|         keepalivedur, err := time.ParseDuration(strconv.FormatInt(int64(keepalive), 10) + "s") |  | ||||||
|         if err != nil { |  | ||||||
|                 log.Fatalf("Issue with format of keepalive value. Please update netconfig: %v", err) |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         fmt.Println("Registering with GRPC Server") |         fmt.Println("Registering with GRPC Server") | ||||||
|         requestOpts := grpc.WithInsecure() |         requestOpts := grpc.WithInsecure() | ||||||
| @@ -234,10 +228,6 @@ func getExtPeers(macaddress string, network string, server string, dualstack boo | |||||||
|                         fmt.Println("Peer is self. Skipping") |                         fmt.Println("Peer is self. Skipping") | ||||||
|                         continue |                         continue | ||||||
|                 } |                 } | ||||||
|                 if nodecfg.Endpoint == res.Extpeers.Endpoint { |  | ||||||
|                         fmt.Println("Peer is self. Skipping") |  | ||||||
|                         continue |  | ||||||
|                 } |  | ||||||
|  |  | ||||||
|                 var peer wgtypes.PeerConfig |                 var peer wgtypes.PeerConfig | ||||||
|                 var peeraddr = net.IPNet{ |                 var peeraddr = net.IPNet{ | ||||||
| @@ -254,28 +244,11 @@ func getExtPeers(macaddress string, network string, server string, dualstack boo | |||||||
|                         } |                         } | ||||||
|                         allowedips = append(allowedips, addr6) |                         allowedips = append(allowedips, addr6) | ||||||
|                 } |                 } | ||||||
|                 if keepalive != 0 { |  | ||||||
|                 peer = wgtypes.PeerConfig{ |                 peer = wgtypes.PeerConfig{ | ||||||
|                         PublicKey: pubkey, |                         PublicKey: pubkey, | ||||||
|                         PersistentKeepaliveInterval: &keepalivedur, |  | ||||||
|                         Endpoint: &net.UDPAddr{ |  | ||||||
|                                 IP:   net.ParseIP(res.Extpeers.Endpoint), |  | ||||||
|                                 Port: int(res.Extpeers.Listenport), |  | ||||||
|                         }, |  | ||||||
|                         ReplaceAllowedIPs: true, |                         ReplaceAllowedIPs: true, | ||||||
|                         AllowedIPs: allowedips, |                         AllowedIPs: allowedips, | ||||||
|                         } |                         } | ||||||
|                 } else { |  | ||||||
|                 peer = wgtypes.PeerConfig{ |  | ||||||
|                         PublicKey: pubkey, |  | ||||||
|                         Endpoint: &net.UDPAddr{ |  | ||||||
|                                 IP:   net.ParseIP(res.Extpeers.Endpoint), |  | ||||||
|                                 Port: int(res.Extpeers.Listenport), |  | ||||||
|                         }, |  | ||||||
|                         ReplaceAllowedIPs: true, |  | ||||||
|                         AllowedIPs: allowedips, |  | ||||||
|                         } |  | ||||||
|                 } |  | ||||||
|                 peers = append(peers, peer) |                 peers = append(peers, peer) | ||||||
|  |  | ||||||
|         } |         } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 root
					root