saving netclient changes

This commit is contained in:
afeiszli
2021-05-05 20:51:59 -04:00
parent 09e0eca54a
commit 1fd30c0a71
7 changed files with 105 additions and 4 deletions

View File

@@ -72,7 +72,7 @@ func GetFreePort(rangestart int32) (int32, error){
return portno, err
}
func Install(accesskey string, password string, server string, network string, noauto bool, accesstoken string, inputname string) error {
func Install(accesskey string, password string, server string, network string, noauto bool, accesstoken string, inputname string, dnsoff bool) error {
tserver := ""
tnetwork := ""
@@ -143,6 +143,8 @@ func Install(accesskey string, password string, server string, network string, n
servercfg := cfg.Server
fmt.Println("SERVER SETTINGS:")
nodecfg.DNSOff = dnsoff
if server == "" {
if servercfg.Address == "" && tserver == "" {
log.Fatal("no server provided")
@@ -588,6 +590,9 @@ func modConfig(node *nodepb.Node) error{
if node.Address != ""{
nodecfg.WGAddress = node.Address
}
if node.Address != ""{
nodecfg.WGAddress = node.Address
}
if node.Postchanges != "" {
nodecfg.PostChanges = node.Postchanges
}
@@ -952,6 +957,15 @@ func CheckIn(network string) error {
setupcheck := true
ipchange := false
if !nodecfg.DNSOff {
vals := strings.Split(servercfg.Address, ":")
server := vals[0]
err = SetDNS(server)
if err != nil {
fmt.Printf("Error encountered setting dns: %v", err)
}
}
if !nodecfg.RoamingOff {
if !nodecfg.IsLocal {
fmt.Println("Checking to see if public addresses have changed")