Skip to content

Commit

Permalink
Merge branch 'feature_v0.4_clients' of https://github.com/gravitl/net…
Browse files Browse the repository at this point in the history
…maker into feature_v0.4_clients
  • Loading branch information
root committed May 20, 2021
2 parents c5c38f0 + 63c2ccd commit 82d430d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 28 deletions.
1 change: 1 addition & 0 deletions netclient/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type NodeConfig struct {
DNSOff bool `yaml:"dnsoff"`
IsLocal bool `yaml:"islocal"`
IsDualStack bool `yaml:"isdualstack"`
IsIngressGateway bool `yaml:"isingressgateway"`
AllowedIPs string `yaml:"allowedips"`
LocalRange string `yaml:"localrange"`
PostUp string `yaml:"postup"`
Expand Down
4 changes: 3 additions & 1 deletion netclient/functions/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ func Install(accesskey string, password string, server string, network string, n
fmt.Println(" Mac Address: " + node.Macaddress)
fmt.Println(" Is Local?: " + strconv.FormatBool(node.Islocal))
fmt.Println(" Is Dual Stack?: " + strconv.FormatBool(node.Isdualstack))
fmt.Println(" Is Ingress Gateway?: " + strconv.FormatBool(node.Isingressgateway))
fmt.Println(" Local Range: " + node.Localrange)

if node.Dnsoff==true && !nodecfg.DNSOff {
Expand Down Expand Up @@ -610,7 +611,7 @@ func modConfig(node *nodepb.Node) error{
if node.Isdualstack == true {
nodecfg.IsDualStack = true
}

nodecfg.IsIngressGateway = node.Isingressgateway
if node.Localrange != "" && node.Islocal {
nodecfg.IsLocal = true
nodecfg.LocalRange = node.Localrange
Expand Down Expand Up @@ -1310,6 +1311,7 @@ func getNode(network string) nodepb.Node {
node.Password = nodecfg.Password
node.Dnsoff = nodecfg.DNSOff
node.Isdualstack = nodecfg.IsDualStack
node.Isingressgateway = nodecfg.IsIngressGateway
return node
}

Expand Down
27 changes: 0 additions & 27 deletions netclient/functions/peers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
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")
requestOpts := grpc.WithInsecure()
Expand Down Expand Up @@ -234,10 +228,6 @@ func getExtPeers(macaddress string, network string, server string, dualstack boo
fmt.Println("Peer is self. Skipping")
continue
}
if nodecfg.Endpoint == res.Extpeers.Endpoint {
fmt.Println("Peer is self. Skipping")
continue
}

var peer wgtypes.PeerConfig
var peeraddr = net.IPNet{
Expand All @@ -254,28 +244,11 @@ func getExtPeers(macaddress string, network string, server string, dualstack boo
}
allowedips = append(allowedips, addr6)
}
if keepalive != 0 {
peer = wgtypes.PeerConfig{
PublicKey: pubkey,
PersistentKeepaliveInterval: &keepalivedur,
Endpoint: &net.UDPAddr{
IP: net.ParseIP(res.Extpeers.Endpoint),
Port: int(res.Extpeers.Listenport),
},
ReplaceAllowedIPs: true,
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)

}
Expand Down

0 comments on commit 82d430d

Please sign in to comment.