GOOD: clean up resolv.conf window

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2021-11-04 02:49:12 -05:00
parent 091a8658b3
commit af62b0320e
7 changed files with 26 additions and 16 deletions

View File

@ -66,6 +66,7 @@ func main() {
// TODO: Change to only exit from systray(?) // TODO: Change to only exit from systray(?)
func initGUI() { func initGUI() {
gui.Config.Exit = customExit gui.Config.Exit = customExit
gui.Config.Stretchy = false
mainWindow(nil) mainWindow(nil)
gui.Config.Exit = nil gui.Config.Exit = nil
} }

View File

@ -1,4 +1,5 @@
# Generated by jcarr # Generated by debian-gui
domain lab.wit.org domain lab.wit.org
search lab.wit.org search lab.wit.org
nameserver 1.1.1.1 nameserver 1.1.1.1

View File

@ -1,4 +1,5 @@
# Generated by jcarr # Generated by git.wit.org/wit/wit-debian-gui
domain lab.wit.org domain lab.wit.org
search 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

View File

@ -1,4 +1,5 @@
# Generated by jcarr # Generated by debian-gui
domain lab.wit.org domain lab.wit.org
search lab.wit.org search lab.wit.org
nameserver 8.8.8.8 nameserver 8.8.8.8

View File

@ -1,4 +1,4 @@
# Generated by jcarr # Generated by debian-gui
domain lab.wit.org domain lab.wit.org
search lab.wit.org search lab.wit.org

View File

@ -1,8 +1,8 @@
# bind.wit.org (a nameserver) should # generated by debian-gui
# always use itself as the nameserver
# I'm not sure, but strange things seem # use this if you are running bind or coredns
# to happen sometimes if you don't -- jcarr
domain lab.wit.org domain lab.wit.org
search lab.wit.org search lab.wit.org
nameserver 127.0.0.1 nameserver 127.0.0.1

View File

@ -13,8 +13,8 @@ var generaloutput *gui.Node
func resolvWindow(w *gui.Node) { func resolvWindow(w *gui.Node) {
if (w == nil) { if (w == nil) {
gui.Config.Title = "resolv.conf Window" gui.Config.Title = "resolv.conf Window"
gui.Config.Width = 113 gui.Config.Width = 1000
gui.Config.Height = 112 gui.Config.Height = 400
gui.Config.Exit = nil gui.Config.Exit = nil
w = gui.NewWindow() w = gui.NewWindow()
} }
@ -40,18 +40,24 @@ func resolvWindow(w *gui.Node) {
resolvNode.OnChanged = func () { resolvNode.OnChanged = func () {
log.Println("STARTED HOSTNAME") log.Println("STARTED HOSTNAME")
filename = resolvNode.GetText() filename = resolvNode.GetText()
b, _ := packrBox.FindString(filename)
if (generaloutput != nil) {
generaloutput.SetText(b)
}
log.Println("ENDED GetText() HOSTNAME =", filename) log.Println("ENDED GetText() HOSTNAME =", filename)
} }
////////////// connect ///////////////////////// ////////////// connect /////////////////////////
gNode = tab.AddGroup("Update") gNode = tab.AddGroup("")
gNode.AddButton("Update /etc/resolv.conf", func (*gui.Node) { gNode.AddButton("Update /etc/resolv.conf", func (*gui.Node) {
sudo( func() error { sudo( func() error {
log.Println("set resolv.conf to",filename) log.Println("set resolv.conf to",filename)
b, _ := packrBox.FindString(filename) b, _ := packrBox.FindString(filename)
log.Println(filename, "=\n\n" + b)
// spew.Dump(b) // spew.Dump(b)
b = generaloutput.GetText()
log.Println("Setting /etc/resolv.conf to:\n\n" + b)
f, err := os.Create("/etc/resolv.conf") f, err := os.Create("/etc/resolv.conf")
if err != nil { if err != nil {
@ -66,10 +72,10 @@ func resolvWindow(w *gui.Node) {
}) })
}) })
gNode.AddButton("test ping ipv4", func (*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) { 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 gui.Config.Stretchy = true
@ -83,6 +89,6 @@ func resolvWindow(w *gui.Node) {
gui.Config.Stretchy = true gui.Config.Stretchy = true
gNode = tab.AddGroup("Update") gNode = tab.AddGroup("Update")
generaloutput = gNode.MakeGroupEdit("output") generaloutput = gNode.MakeGroupEdit("resolv.conf:")
gui.Config.Stretchy = false gui.Config.Stretchy = false
} }