finish dsnet init -- write to sys file

This commit is contained in:
Callan Bryant 2020-03-01 23:52:20 +00:00
parent 2c3bb65612
commit 55ee25d943
No known key found for this signature in database
GPG Key ID: C31FA9DF3ACBFFAA

View File

@ -6,6 +6,7 @@ import (
"math/rand" "math/rand"
"net" "net"
"time" "time"
"io/ioutil"
//"github.com/mikioh/ipaddr" //"github.com/mikioh/ipaddr"
) )
@ -23,12 +24,11 @@ func Init() {
ReportFile: DEFAULT_REPORT_FILE, ReportFile: DEFAULT_REPORT_FILE,
} }
//fmt.Println(conf.Network.String())
//fmt.Printf("%-+v/n",conf)
_json, _ := json.MarshalIndent(conf, "", " ") _json, _ := json.MarshalIndent(conf, "", " ")
err := ioutil.WriteFile(CONFIG_FILE, _json, 0600)
check(err)
fmt.Println(string(_json)) fmt.Printf("Config written to %s. Please edit.", CONFIG_FILE)
} }
// get a random /22 subnet on 10.0.0.0 (1023 hosts) (or /24?) // get a random /22 subnet on 10.0.0.0 (1023 hosts) (or /24?)