From 55ee25d9436f3218801a558ba5fc38b566209fe7 Mon Sep 17 00:00:00 2001 From: Callan Bryant Date: Sun, 1 Mar 2020 23:52:20 +0000 Subject: [PATCH] finish dsnet init -- write to sys file --- init.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/init.go b/init.go index 29f0833..95758b9 100644 --- a/init.go +++ b/init.go @@ -6,6 +6,7 @@ import ( "math/rand" "net" "time" + "io/ioutil" //"github.com/mikioh/ipaddr" ) @@ -23,12 +24,11 @@ func Init() { ReportFile: DEFAULT_REPORT_FILE, } - //fmt.Println(conf.Network.String()) - //fmt.Printf("%-+v/n",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?)