From af62b0320e1f82cd2e2a5c145eb015603ebb234d Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 4 Nov 2021 02:49:12 -0500 Subject: [PATCH] GOOD: clean up resolv.conf window Signed-off-by: Jeff Carr --- main.go | 1 + resources/resolv/resolv-1-1-1-1.conf | 3 ++- resources/resolv/resolv-4.2.2.2.conf | 5 +++-- resources/resolv/resolv-8-8-8-8.conf | 3 ++- resources/resolv/resolv-ipv6-only.conf | 2 +- resources/resolv/resolv-localhost.conf | 8 ++++---- window-resolv.go | 20 +++++++++++++------- 7 files changed, 26 insertions(+), 16 deletions(-) diff --git a/main.go b/main.go index 086c166..d1f6862 100644 --- a/main.go +++ b/main.go @@ -66,6 +66,7 @@ func main() { // TODO: Change to only exit from systray(?) func initGUI() { gui.Config.Exit = customExit + gui.Config.Stretchy = false mainWindow(nil) gui.Config.Exit = nil } diff --git a/resources/resolv/resolv-1-1-1-1.conf b/resources/resolv/resolv-1-1-1-1.conf index e998672..56f76f6 100644 --- a/resources/resolv/resolv-1-1-1-1.conf +++ b/resources/resolv/resolv-1-1-1-1.conf @@ -1,4 +1,5 @@ -# Generated by jcarr +# Generated by debian-gui domain lab.wit.org search lab.wit.org + nameserver 1.1.1.1 diff --git a/resources/resolv/resolv-4.2.2.2.conf b/resources/resolv/resolv-4.2.2.2.conf index 7a58bb9..7f52beb 100644 --- a/resources/resolv/resolv-4.2.2.2.conf +++ b/resources/resolv/resolv-4.2.2.2.conf @@ -1,4 +1,5 @@ -# Generated by jcarr +# Generated by git.wit.org/wit/wit-debian-gui domain lab.wit.org search lab.wit.org -nameserver 4.2.2.2 # as of 2021/06/05 does not resolve *.lab.wit.org + +nameserver 4.2.2.2 diff --git a/resources/resolv/resolv-8-8-8-8.conf b/resources/resolv/resolv-8-8-8-8.conf index bba2290..4de844e 100644 --- a/resources/resolv/resolv-8-8-8-8.conf +++ b/resources/resolv/resolv-8-8-8-8.conf @@ -1,4 +1,5 @@ -# Generated by jcarr +# Generated by debian-gui domain lab.wit.org search lab.wit.org + nameserver 8.8.8.8 diff --git a/resources/resolv/resolv-ipv6-only.conf b/resources/resolv/resolv-ipv6-only.conf index 4efd314..6c6266e 100644 --- a/resources/resolv/resolv-ipv6-only.conf +++ b/resources/resolv/resolv-ipv6-only.conf @@ -1,4 +1,4 @@ -# Generated by jcarr +# Generated by debian-gui domain lab.wit.org search lab.wit.org diff --git a/resources/resolv/resolv-localhost.conf b/resources/resolv/resolv-localhost.conf index f536e95..686d710 100644 --- a/resources/resolv/resolv-localhost.conf +++ b/resources/resolv/resolv-localhost.conf @@ -1,8 +1,8 @@ -# bind.wit.org (a nameserver) should -# always use itself as the nameserver -# I'm not sure, but strange things seem -# to happen sometimes if you don't -- jcarr +# generated by debian-gui + +# use this if you are running bind or coredns domain lab.wit.org search lab.wit.org + nameserver 127.0.0.1 diff --git a/window-resolv.go b/window-resolv.go index e32708e..8feaa5f 100644 --- a/window-resolv.go +++ b/window-resolv.go @@ -13,8 +13,8 @@ var generaloutput *gui.Node func resolvWindow(w *gui.Node) { if (w == nil) { gui.Config.Title = "resolv.conf Window" - gui.Config.Width = 113 - gui.Config.Height = 112 + gui.Config.Width = 1000 + gui.Config.Height = 400 gui.Config.Exit = nil w = gui.NewWindow() } @@ -40,18 +40,24 @@ func resolvWindow(w *gui.Node) { resolvNode.OnChanged = func () { log.Println("STARTED HOSTNAME") filename = resolvNode.GetText() + b, _ := packrBox.FindString(filename) + if (generaloutput != nil) { + generaloutput.SetText(b) + } log.Println("ENDED GetText() HOSTNAME =", filename) } ////////////// connect ///////////////////////// - gNode = tab.AddGroup("Update") + gNode = tab.AddGroup("") gNode.AddButton("Update /etc/resolv.conf", func (*gui.Node) { sudo( func() error { log.Println("set resolv.conf to",filename) b, _ := packrBox.FindString(filename) - log.Println(filename, "=\n\n" + b) // spew.Dump(b) + b = generaloutput.GetText() + + log.Println("Setting /etc/resolv.conf to:\n\n" + b) f, err := os.Create("/etc/resolv.conf") if err != nil { @@ -66,10 +72,10 @@ func resolvWindow(w *gui.Node) { }) }) gNode.AddButton("test ping ipv4", func (*gui.Node) { - bash("ping -c 3 1.1.1.1") + bash("ping -c 3 -4 google.com") }) gNode.AddButton("test ping ipv6", func (*gui.Node) { - bash("ping -c 3 2001:4860:4860::6464") + bash("ping -c 3 -6 google.com") }) gui.Config.Stretchy = true @@ -83,6 +89,6 @@ func resolvWindow(w *gui.Node) { gui.Config.Stretchy = true gNode = tab.AddGroup("Update") - generaloutput = gNode.MakeGroupEdit("output") + generaloutput = gNode.MakeGroupEdit("resolv.conf:") gui.Config.Stretchy = false }