Compare commits
No commits in common. "259b4bdb408fd234cf1c76f94463a85d87fdadb6" and "5e9f1591cab5602ac9d9f6e6a24f83ba5dc86126" have entirely different histories.
259b4bdb40
...
5e9f1591ca
|
@ -245,14 +245,6 @@ func (ds *digStatus) updateDnsStatus() {
|
||||||
out = shell.Run(cmd)
|
out = shell.Run(cmd)
|
||||||
log.Log(DNS, "makeDnsStatusGrid() dig", out)
|
log.Log(DNS, "makeDnsStatusGrid() dig", out)
|
||||||
me.digStatus.set(ds.DnsDigTCP, out)
|
me.digStatus.set(ds.DnsDigTCP, out)
|
||||||
|
|
||||||
/*
|
|
||||||
g2.NewButton("dig +trace", func () {
|
|
||||||
log.Log(NOW, "TODO: redo this")
|
|
||||||
// o := shell.Run("dig +trace +noadditional DS " + me.hostname + " @8.8.8.8")
|
|
||||||
// log.Println(o)
|
|
||||||
})
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ds *digStatus) makeHttpStatusGrid() {
|
func (ds *digStatus) makeHttpStatusGrid() {
|
||||||
|
|
47
errorBox.go
47
errorBox.go
|
@ -1,47 +0,0 @@
|
||||||
/*
|
|
||||||
Show a box for a configuration error
|
|
||||||
*/
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"go.wit.com/log"
|
|
||||||
"go.wit.com/gui/gui"
|
|
||||||
"go.wit.com/gui/gadgets"
|
|
||||||
)
|
|
||||||
|
|
||||||
type errorBox struct {
|
|
||||||
name string // the problem name
|
|
||||||
|
|
||||||
parent *gui.Node
|
|
||||||
group *gui.Node
|
|
||||||
grid *gui.Node
|
|
||||||
|
|
||||||
l *gui.Node
|
|
||||||
b *gui.Node
|
|
||||||
|
|
||||||
something *gadgets.OneLiner
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewErrorBox(p *gui.Node, name string) *errorBox {
|
|
||||||
var eb *errorBox
|
|
||||||
eb = new(errorBox)
|
|
||||||
eb.parent = p
|
|
||||||
// eb.group = p.NewGroup("eg")
|
|
||||||
// eb.grid = eb.group.NewGrid("labels", 2, 1)
|
|
||||||
|
|
||||||
eb.l = p.NewLabel("click to fix")
|
|
||||||
eb.b = p.NewButton("fix", func() {
|
|
||||||
log.Log(WARN, "should try to fix here")
|
|
||||||
})
|
|
||||||
eb.something = gadgets.NewOneLiner(eb.grid, "something")
|
|
||||||
|
|
||||||
return eb
|
|
||||||
}
|
|
||||||
|
|
||||||
func (eb *errorBox) update() bool {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (eb *errorBox) toggle() {
|
|
||||||
}
|
|
26
fix.go
26
fix.go
|
@ -4,7 +4,6 @@ package main
|
||||||
import (
|
import (
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
"go.wit.com/gui/cloudflare"
|
"go.wit.com/gui/cloudflare"
|
||||||
"go.wit.com/control-panels/dns/smartwindow"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func fix() bool {
|
func fix() bool {
|
||||||
|
@ -36,11 +35,11 @@ func fix() bool {
|
||||||
log.Log(CHANGE, "OK You do not have real IPv4 addresses. Nothing to fix here")
|
log.Log(CHANGE, "OK You do not have real IPv4 addresses. Nothing to fix here")
|
||||||
}
|
}
|
||||||
if ! me.statusDNS.IPv6() {
|
if ! me.statusDNS.IPv6() {
|
||||||
|
log.Log(CHANGE, "IPv6 DNS is broken. Check what is broken here")
|
||||||
if fixIPv6dns() {
|
if fixIPv6dns() {
|
||||||
log.Log(CHANGE, "IPv6 DNS Repair is underway")
|
log.Log(CHANGE, "IPv6 DNS Repair is underway")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
log.Log(CHANGE, "GOOD IPv6 DNS is working!")
|
|
||||||
}
|
}
|
||||||
log.Log(CHANGE, "GOOD YOU SHOULD BE IN IPv6 BLISS")
|
log.Log(CHANGE, "GOOD YOU SHOULD BE IN IPv6 BLISS")
|
||||||
return true
|
return true
|
||||||
|
@ -66,16 +65,13 @@ func fixIPv6dns() bool {
|
||||||
// remove old DNS entries first
|
// remove old DNS entries first
|
||||||
for aaaa, _ := range dnsAAAA {
|
for aaaa, _ := range dnsAAAA {
|
||||||
if osAAAA[aaaa] == "dns" {
|
if osAAAA[aaaa] == "dns" {
|
||||||
broken = true
|
|
||||||
log.Log(INFO, "DNS AAAA is not in OS", aaaa)
|
log.Log(INFO, "DNS AAAA is not in OS", aaaa)
|
||||||
addToFixWindow("DELETE", aaaa)
|
broken = true
|
||||||
/*
|
|
||||||
if deleteFromDNS(aaaa) {
|
if deleteFromDNS(aaaa) {
|
||||||
log.Log(INFO, "Delete AAAA", aaaa, "Worked")
|
log.Log(INFO, "Delete AAAA", aaaa, "Worked")
|
||||||
} else {
|
} else {
|
||||||
log.Log(INFO, "Delete AAAA", aaaa, "Failed")
|
log.Log(INFO, "Delete AAAA", aaaa, "Failed")
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
} else {
|
} else {
|
||||||
log.Log(INFO, "DNS AAAA is in OS", aaaa)
|
log.Log(INFO, "DNS AAAA is in OS", aaaa)
|
||||||
}
|
}
|
||||||
|
@ -88,14 +84,11 @@ func fixIPv6dns() bool {
|
||||||
} else {
|
} else {
|
||||||
broken = true
|
broken = true
|
||||||
log.Log(INFO, "OS AAAA is not in DNS", aaaa)
|
log.Log(INFO, "OS AAAA is not in DNS", aaaa)
|
||||||
addToFixWindow("CREATE", aaaa)
|
|
||||||
/*
|
|
||||||
if addToDNS(aaaa) {
|
if addToDNS(aaaa) {
|
||||||
log.Log(INFO, "Add AAAA", aaaa, "Worked")
|
log.Log(INFO, "Add AAAA", aaaa, "Worked")
|
||||||
} else {
|
} else {
|
||||||
log.Log(INFO, "Add AAAA", aaaa, "Failed")
|
log.Log(INFO, "Add AAAA", aaaa, "Failed")
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,18 +119,3 @@ func exists(m map[string]bool, s string) bool {
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func addToFixWindow(t string, ip string) {
|
|
||||||
if me.fixWindow == nil {
|
|
||||||
me.fixWindow = smartwindow.New()
|
|
||||||
me.fixWindow.SetParent(me.myGui)
|
|
||||||
me.fixWindow.InitWindow()
|
|
||||||
me.fixWindow.Title("fix window")
|
|
||||||
me.fixWindow.SetDraw(drawFixWindow)
|
|
||||||
me.fixWindow.Make()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func drawFixWindow(sw *smartwindow.SmartWindow) {
|
|
||||||
log.Log(WARN, "drawFixWindow() START")
|
|
||||||
}
|
|
||||||
|
|
81
gui.go
81
gui.go
|
@ -5,7 +5,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"sort"
|
|
||||||
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
|
||||||
|
@ -13,7 +12,7 @@ import (
|
||||||
"go.wit.com/gui/gadgets"
|
"go.wit.com/gui/gadgets"
|
||||||
"go.wit.com/gui/cloudflare"
|
"go.wit.com/gui/cloudflare"
|
||||||
"go.wit.com/gui/debugger"
|
"go.wit.com/gui/debugger"
|
||||||
// "go.wit.com/control-panels/dns/linuxstatus"
|
"go.wit.com/control-panels/dns/linuxstatus"
|
||||||
)
|
)
|
||||||
|
|
||||||
// This setups up the dns control panel window
|
// This setups up the dns control panel window
|
||||||
|
@ -44,6 +43,17 @@ func debugTab(title string) {
|
||||||
updateDNS()
|
updateDNS()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
g2.NewButton("dig +trace", func () {
|
||||||
|
log.Log(NOW, "TODO: redo this")
|
||||||
|
// o := shell.Run("dig +trace +noadditional DS " + me.hostname + " @8.8.8.8")
|
||||||
|
// log.Println(o)
|
||||||
|
})
|
||||||
|
|
||||||
|
g2.NewButton("getProcessNameByPort()", func () {
|
||||||
|
processName := linuxstatus.GetProcessNameByPort(53)
|
||||||
|
log.Info("Process with port 53:", processName)
|
||||||
|
})
|
||||||
|
|
||||||
g2 = me.debug.Box().NewGroup("debugging options")
|
g2 = me.debug.Box().NewGroup("debugging options")
|
||||||
|
|
||||||
// makes a slider widget
|
// makes a slider widget
|
||||||
|
@ -60,6 +70,32 @@ func debugTab(title string) {
|
||||||
me.debug.Hide()
|
me.debug.Hide()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// will return a AAAA value that needs to be deleted
|
||||||
|
func deleteAAA() string {
|
||||||
|
var aaaa []string
|
||||||
|
aaaa = dhcpAAAA() // your AAAA IP addresses right now
|
||||||
|
for _, s := range aaaa {
|
||||||
|
log.Log(NOW, "DNS AAAA =", s)
|
||||||
|
if ( me.ipmap[s] == nil) {
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// will return a AAAA value that needs to be added
|
||||||
|
func missingAAAA() string {
|
||||||
|
var aaaa []string
|
||||||
|
aaaa = dhcpAAAA() // your AAAA IP addresses right now
|
||||||
|
for _, s := range aaaa {
|
||||||
|
log.Log(NOW, "missing AAAA =", s)
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// doesn't actually do any network traffic
|
// doesn't actually do any network traffic
|
||||||
// it just updates the GUI
|
// it just updates the GUI
|
||||||
func displayDNS() string {
|
func displayDNS() string {
|
||||||
|
@ -83,8 +119,7 @@ func displayDNS() string {
|
||||||
|
|
||||||
var a []string
|
var a []string
|
||||||
a = append(a, "fixme")
|
a = append(a, "fixme")
|
||||||
sort.Strings(a)
|
all = sortLines(strings.Join(a, "\n"))
|
||||||
all = strings.Join(a, "\n")
|
|
||||||
if (all == "") {
|
if (all == "") {
|
||||||
log.Log(NOW, "THERE IS NOT a real A DNS ENTRY")
|
log.Log(NOW, "THERE IS NOT a real A DNS ENTRY")
|
||||||
all = "CNAME ipv6.wit.com"
|
all = "CNAME ipv6.wit.com"
|
||||||
|
@ -116,18 +151,8 @@ func mainWindow(title string) {
|
||||||
me.DnsA = grid.NewLabel("?")
|
me.DnsA = grid.NewLabel("?")
|
||||||
|
|
||||||
// This is where you figure out what to do next to fix the problems
|
// This is where you figure out what to do next to fix the problems
|
||||||
me.fixButton = gr.NewButton("fix", func () {
|
gr.NewButton("fix", func () {
|
||||||
if ! fix() {
|
fix()
|
||||||
log.Log(CHANGE, "boo. IPv6 isn't working yet")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
log.Log(CHANGE, "IPv6 WORKED")
|
|
||||||
// update everything here visually for the user
|
|
||||||
hostname := me.statusOS.GetHostname()
|
|
||||||
me.hostname.Set(hostname)
|
|
||||||
me.hostnameStatus.Set("WORKING")
|
|
||||||
me.DnsStatus.Set("WORKING")
|
|
||||||
me.fixButton.Disable()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
grid.Margin()
|
grid.Margin()
|
||||||
|
@ -136,10 +161,30 @@ func mainWindow(title string) {
|
||||||
statusGrid(me.window.Box())
|
statusGrid(me.window.Box())
|
||||||
|
|
||||||
gr = me.window.Box().NewGroup("debugging")
|
gr = me.window.Box().NewGroup("debugging")
|
||||||
me.statusDNSbutton = gr.NewButton("hostname status", func () {
|
gr.NewButton("hostname status", func () {
|
||||||
if ! me.statusDNS.Ready() {return}
|
if ! me.statusDNS.Ready() {return}
|
||||||
me.statusDNS.window.Toggle()
|
me.statusDNS.window.Toggle()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
gr.NewButton("linuxstatus.New()", func () {
|
||||||
|
if (me.statusOS == nil) {
|
||||||
|
me.statusOS = linuxstatus.New()
|
||||||
|
}
|
||||||
|
me.statusOS.SetParent(me.myGui)
|
||||||
|
me.statusOS.InitWindow()
|
||||||
|
me.statusOS.Make()
|
||||||
|
me.statusOS.Draw2()
|
||||||
|
})
|
||||||
|
gr.NewButton("statusOS.Ready()", func () {
|
||||||
|
me.statusOS.Ready()
|
||||||
|
})
|
||||||
|
gr.NewButton("statusOS.Draw()", func () {
|
||||||
|
me.statusOS.Draw()
|
||||||
|
me.statusOS.Draw2()
|
||||||
|
})
|
||||||
|
gr.NewButton("statusOS.Update()", func () {
|
||||||
|
me.statusOS.Update()
|
||||||
|
})
|
||||||
gr.NewButton("Linux Status", func () {
|
gr.NewButton("Linux Status", func () {
|
||||||
me.statusOS.Toggle()
|
me.statusOS.Toggle()
|
||||||
})
|
})
|
||||||
|
@ -211,7 +256,7 @@ func updateDNS() {
|
||||||
var aaaa []string
|
var aaaa []string
|
||||||
h := me.statusOS.GetHostname()
|
h := me.statusOS.GetHostname()
|
||||||
aaaa = digAAAA(h)
|
aaaa = digAAAA(h)
|
||||||
log.Log(INFO, "digAAAA() for", h, "=", aaaa)
|
log.Log(NOW, "digAAAA() for", h, "=", aaaa)
|
||||||
|
|
||||||
// log.Println(SPEW, me)
|
// log.Println(SPEW, me)
|
||||||
if (aaaa == nil) {
|
if (aaaa == nil) {
|
||||||
|
|
|
@ -11,7 +11,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
"sort"
|
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
@ -23,6 +22,7 @@ type hostnameStatus struct {
|
||||||
ready bool
|
ready bool
|
||||||
hidden bool
|
hidden bool
|
||||||
|
|
||||||
|
// hostname string // my hostname. Example: "test.wit.com"
|
||||||
lastname string // used to watch for changes in the hostname
|
lastname string // used to watch for changes in the hostname
|
||||||
|
|
||||||
window *gadgets.BasicWindow
|
window *gadgets.BasicWindow
|
||||||
|
@ -33,12 +33,14 @@ type hostnameStatus struct {
|
||||||
statusIPv4 *gadgets.OneLiner
|
statusIPv4 *gadgets.OneLiner
|
||||||
statusIPv6 *gadgets.OneLiner
|
statusIPv6 *gadgets.OneLiner
|
||||||
|
|
||||||
hostname *gadgets.OneLiner
|
// Details Group
|
||||||
|
hostShort *gadgets.OneLiner
|
||||||
domainname *gadgets.OneLiner
|
domainname *gadgets.OneLiner
|
||||||
|
|
||||||
// what the current IP addresses your network has given you
|
// what the current IP address your network has given you
|
||||||
currentIPv4 *gadgets.OneLiner
|
currentIPv4 *gadgets.OneLiner
|
||||||
currentIPv6 *gadgets.OneLiner
|
currentIPv6 *gadgets.OneLiner
|
||||||
|
currentAAAA string
|
||||||
|
|
||||||
// what the DNS servers have
|
// what the DNS servers have
|
||||||
NSrr *gadgets.OneLiner
|
NSrr *gadgets.OneLiner
|
||||||
|
@ -79,7 +81,7 @@ func NewHostnameStatusWindow(p *gui.Node) *hostnameStatus {
|
||||||
group = hs.window.Box().NewGroup("Details")
|
group = hs.window.Box().NewGroup("Details")
|
||||||
grid = group.NewGrid("LookupDetails", 2, 2)
|
grid = group.NewGrid("LookupDetails", 2, 2)
|
||||||
|
|
||||||
hs.hostname = gadgets.NewOneLiner(grid, "hostname")
|
hs.hostShort = gadgets.NewOneLiner(grid, "hostname -s")
|
||||||
hs.domainname = gadgets.NewOneLiner(grid, "domain name")
|
hs.domainname = gadgets.NewOneLiner(grid, "domain name")
|
||||||
hs.currentIPv4 = gadgets.NewOneLiner(grid, "Current IPv4")
|
hs.currentIPv4 = gadgets.NewOneLiner(grid, "Current IPv4")
|
||||||
hs.currentIPv6 = gadgets.NewOneLiner(grid, "Current IPv6")
|
hs.currentIPv6 = gadgets.NewOneLiner(grid, "Current IPv6")
|
||||||
|
@ -119,6 +121,12 @@ func NewHostnameStatusWindow(p *gui.Node) *hostnameStatus {
|
||||||
return hs
|
return hs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
func (hs *hostnameStatus) ValidHostname() bool {
|
||||||
|
return goodHostname()
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func (hs *hostnameStatus) Domain() string {
|
func (hs *hostnameStatus) Domain() string {
|
||||||
if ! hs.Ready() {return ""}
|
if ! hs.Ready() {return ""}
|
||||||
return hs.domainname.Get()
|
return hs.domainname.Get()
|
||||||
|
@ -129,6 +137,34 @@ func (hs *hostnameStatus) API() string {
|
||||||
return hs.dnsAPI.Get()
|
return hs.dnsAPI.Get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
func (hs *hostnameStatus) deleteDNSrecord(value string) bool {
|
||||||
|
log.Info("deleteDNSrecord() START for", value)
|
||||||
|
log.Info("deleteDNSrecord() hostname =", me.status.GetHostname())
|
||||||
|
log.Info("deleteDNSrecord() domain =", hs.Domain())
|
||||||
|
log.Info("deleteDNSrecord() DNS API Provider =", hs.API())
|
||||||
|
|
||||||
|
if (hs.API() == "cloudflare") {
|
||||||
|
log.Info("deleteDNSrecord() Try to delete via cloudflare")
|
||||||
|
return cloudflare.Delete(hs.Domain(), me.status.GetHostname(), value)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (hs *hostnameStatus) createDNSrecord(value string) bool {
|
||||||
|
log.Info("createDNSrecord() START for", value)
|
||||||
|
log.Info("createDNSrecord() hostname =", me.status.GetHostname())
|
||||||
|
log.Info("createDNSrecord() domain =", hs.Domain())
|
||||||
|
log.Info("createDNSrecord() DNS API Provider =", hs.API())
|
||||||
|
|
||||||
|
if (hs.API() == "cloudflare") {
|
||||||
|
log.Warn("createDNSrecord() Try to create via cloudflare:", me.status.GetHostname(), value)
|
||||||
|
return cloudflare.Create(hs.Domain(), me.status.GetHostname(), value)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func (hs *hostnameStatus) Update() {
|
func (hs *hostnameStatus) Update() {
|
||||||
log.Info("hostnameStatus() Update() START")
|
log.Info("hostnameStatus() Update() START")
|
||||||
if hs == nil {
|
if hs == nil {
|
||||||
|
@ -246,7 +282,7 @@ func (hs *hostnameStatus) missingAAAA() bool {
|
||||||
|
|
||||||
func (hs *hostnameStatus) GetIPv6() []string {
|
func (hs *hostnameStatus) GetIPv6() []string {
|
||||||
if ! hs.Ready() { return nil}
|
if ! hs.Ready() { return nil}
|
||||||
return strings.Split(hs.dnsAAAA.Get(), "\n")
|
return strings.Split(hs.currentAAAA, "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (hs *hostnameStatus) updateStatus() {
|
func (hs *hostnameStatus) updateStatus() {
|
||||||
|
@ -255,27 +291,9 @@ func (hs *hostnameStatus) updateStatus() {
|
||||||
var vals []string
|
var vals []string
|
||||||
log.Log(STATUS, "updateStatus() START")
|
log.Log(STATUS, "updateStatus() START")
|
||||||
|
|
||||||
// copy the OS status over
|
hs.hostShort.Set(me.statusOS.GetHostShort())
|
||||||
lasthostname := hs.hostname.Get()
|
|
||||||
hostname := me.statusOS.GetHostname()
|
|
||||||
|
|
||||||
// hostname changed or was setup for the first time. Set the window title, etc
|
|
||||||
if lasthostname != hostname {
|
|
||||||
me.changed = true
|
|
||||||
hs.hostname.Set(hostname)
|
|
||||||
hs.window.Title(hostname + " Status")
|
|
||||||
me.statusDNSbutton.Set(hostname + " status")
|
|
||||||
}
|
|
||||||
hs.domainname.Set(me.statusOS.GetDomainName())
|
hs.domainname.Set(me.statusOS.GetDomainName())
|
||||||
|
|
||||||
tmp := me.statusOS.GetIPv4()
|
|
||||||
sort.Strings(tmp)
|
|
||||||
hs.currentIPv4.Set(strings.Join(tmp, "\n"))
|
|
||||||
|
|
||||||
tmp = me.statusOS.GetIPv6()
|
|
||||||
sort.Strings(tmp)
|
|
||||||
hs.currentIPv6.Set(strings.Join(tmp, "\n"))
|
|
||||||
|
|
||||||
if me.statusOS.ValidHostname() {
|
if me.statusOS.ValidHostname() {
|
||||||
vals = lookupDoH(me.statusOS.GetHostname(), "AAAA")
|
vals = lookupDoH(me.statusOS.GetHostname(), "AAAA")
|
||||||
|
|
||||||
|
@ -297,8 +315,7 @@ func (hs *hostnameStatus) updateStatus() {
|
||||||
// hs.dnsAction.SetText("DELETE")
|
// hs.dnsAction.SetText("DELETE")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sort.Strings(vals)
|
hs.currentAAAA = strings.Join(vals, "\n")
|
||||||
hs.dnsAAAA.Set(strings.Join(vals, "\n"))
|
|
||||||
|
|
||||||
vals = lookupDoH(me.statusOS.GetHostname(), "A")
|
vals = lookupDoH(me.statusOS.GetHostname(), "A")
|
||||||
log.Log(STATUS, "IPv4 Addresses for ", me.statusOS.GetHostname(), "=", vals)
|
log.Log(STATUS, "IPv4 Addresses for ", me.statusOS.GetHostname(), "=", vals)
|
||||||
|
@ -317,6 +334,11 @@ func (hs *hostnameStatus) updateStatus() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// hs.currentIPv4.Set(me.IPv4.S)
|
||||||
|
// hs.currentIPv6.Set(me.IPv6.S)
|
||||||
|
hs.currentIPv4.Set("get this from linuxStatus")
|
||||||
|
hs.currentIPv6.Set("get this from linuxStatus")
|
||||||
|
|
||||||
if hs.IPv4() && hs.IPv6() {
|
if hs.IPv4() && hs.IPv6() {
|
||||||
hs.status.Set("GOOD")
|
hs.status.Set("GOOD")
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -24,7 +24,6 @@ func draw(ls *LinuxStatus) {
|
||||||
ls.uid = gadgets.NewOneLiner(ls.grid, "UID =")
|
ls.uid = gadgets.NewOneLiner(ls.grid, "UID =")
|
||||||
ls.IPv4 = gadgets.NewOneLiner(ls.grid, "Current IPv4 =")
|
ls.IPv4 = gadgets.NewOneLiner(ls.grid, "Current IPv4 =")
|
||||||
ls.IPv6 = gadgets.NewOneLiner(ls.grid, "Current IPv6 =")
|
ls.IPv6 = gadgets.NewOneLiner(ls.grid, "Current IPv6 =")
|
||||||
ls.workingIPv4 = gadgets.NewOneLiner(ls.grid, "Real IPv4 =")
|
|
||||||
ls.workingIPv6 = gadgets.NewOneLiner(ls.grid, "Real IPv6 =")
|
ls.workingIPv6 = gadgets.NewOneLiner(ls.grid, "Real IPv6 =")
|
||||||
// ls.nics = gadgets.NewOneLiner(ls.grid, "network intefaces =")
|
// ls.nics = gadgets.NewOneLiner(ls.grid, "network intefaces =")
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
package linuxstatus
|
package linuxstatus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"strings"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
"go.wit.com/shell"
|
||||||
|
|
||||||
// will try to get this hosts FQDN
|
// will try to get this hosts FQDN
|
||||||
"github.com/Showmax/go-fqdn"
|
"github.com/Showmax/go-fqdn"
|
||||||
|
@ -64,6 +65,12 @@ func (ls *LinuxStatus) setHostShort() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ls *LinuxStatus) GetIPv6() []string {
|
||||||
|
if ! me.Ready() {return nil}
|
||||||
|
tmp := me.workingIPv6.Get()
|
||||||
|
return strings.Split(tmp, "\n")
|
||||||
|
}
|
||||||
|
|
||||||
func lookupHostname() {
|
func lookupHostname() {
|
||||||
if ! me.Ready() {return}
|
if ! me.Ready() {return}
|
||||||
var err error
|
var err error
|
||||||
|
@ -117,14 +124,7 @@ func lookupHostname() {
|
||||||
// On Linux, /etc/hosts, /etc/hostname
|
// On Linux, /etc/hosts, /etc/hostname
|
||||||
// and domainname and hostname
|
// and domainname and hostname
|
||||||
func goodHostname() bool {
|
func goodHostname() bool {
|
||||||
content, err := ioutil.ReadFile("/etc/hostname")
|
hostname := shell.Chomp(shell.Cat("/etc/hostname"))
|
||||||
if err != nil {
|
|
||||||
// this needs to be a fixWindow() error
|
|
||||||
log.Error(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
hostname := string(content)
|
|
||||||
|
|
||||||
log.Log(NOW, "hostname =", hostname)
|
log.Log(NOW, "hostname =", hostname)
|
||||||
|
|
||||||
hs := run("hostname -s")
|
hs := run("hostname -s")
|
||||||
|
|
|
@ -1,88 +1,38 @@
|
||||||
// GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
|
// GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
|
||||||
// Copyright (c) 2023 WIT.COM, Inc.
|
// Copyright (c) 2023 WIT.COM, Inc.
|
||||||
|
|
||||||
// This is a control panel for DNS
|
// This is a control panel for DNS
|
||||||
|
|
||||||
// This is the main Linux kernel / OS code
|
|
||||||
// to check your network settings are correct
|
|
||||||
// This does (and should do) no network or external checking
|
|
||||||
// This is just the state of your OS
|
|
||||||
|
|
||||||
package linuxstatus
|
package linuxstatus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"os/user"
|
"os/user"
|
||||||
"io/ioutil"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sort"
|
|
||||||
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func linuxLoop() {
|
func linuxLoop() {
|
||||||
me.changed = false
|
me.changed = false
|
||||||
|
duration := timeFunction(lookupHostname)
|
||||||
|
log.Log(INFO, "getHostname() execution Time: ", duration, "me.changed =", me.changed)
|
||||||
|
|
||||||
// checks for a VALID hostname
|
duration = timeFunction(scanInterfaces)
|
||||||
lookupHostname()
|
log.Log(NET, "scanInterfaces() execution Time: ", duration)
|
||||||
if me.changed {
|
|
||||||
log.Log(CHANGE, "lookupHostname() detected a change")
|
|
||||||
}
|
|
||||||
|
|
||||||
// scans the linux network intefaces for your available IPv4 & IPv6 addresses
|
|
||||||
scanInterfaces()
|
|
||||||
if me.changed {
|
|
||||||
log.Log(CHANGE, "scanInterfaces() detected a change")
|
|
||||||
}
|
|
||||||
for i, t := range me.ifmap {
|
for i, t := range me.ifmap {
|
||||||
log.Log(NET, strconv.Itoa(i) + " iface = " + t.iface.Name)
|
log.Log(NET, strconv.Itoa(i) + " iface = " + t.iface.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// get all the real A records from all the network interfaces linux can see
|
|
||||||
a := realA()
|
|
||||||
sort.Strings(a)
|
|
||||||
tmp := strings.Join(a, "\n")
|
|
||||||
if tmp != me.workingIPv4.Get() {
|
|
||||||
log.Log(CHANGE, "realAAAA() your real IPv6 addresses changed")
|
|
||||||
me.changed = true
|
|
||||||
me.workingIPv4.Set(tmp)
|
|
||||||
}
|
|
||||||
|
|
||||||
// get all the real AAAA records from all the network interfaces linux can see
|
// get all the real AAAA records from all the network interfaces linux can see
|
||||||
aaaa := realAAAA()
|
tmp := strings.Join(realAAAA(), "\n")
|
||||||
sort.Strings(aaaa)
|
tmp = sortLines(tmp)
|
||||||
tmp = strings.Join(aaaa, "\n")
|
me.workingIPv6.Set(tmp)
|
||||||
if tmp != me.workingIPv6.Get() {
|
|
||||||
log.Log(CHANGE, "realAAAA() your real IPv6 addresses changed")
|
|
||||||
me.changed = true
|
|
||||||
me.workingIPv6.Set(tmp)
|
|
||||||
}
|
|
||||||
|
|
||||||
user, _ := user.Current()
|
user, _ := user.Current()
|
||||||
tmp = user.Username + " (" + strconv.Itoa(os.Getuid()) + ")"
|
log.Log(INFO, "os.Getuid =", user.Username, os.Getuid())
|
||||||
if tmp != me.uid.Get() {
|
if (me.uid != nil) {
|
||||||
log.Log(CHANGE, "os.Getuid =", user.Username, os.Getuid())
|
me.uid.Set(user.Username + " (" + strconv.Itoa(os.Getuid()) + ")")
|
||||||
me.changed = true
|
|
||||||
me.uid.Set(tmp)
|
|
||||||
}
|
|
||||||
|
|
||||||
content, _ := ioutil.ReadFile("/etc/resolv.conf")
|
|
||||||
var ns []string
|
|
||||||
for _, line := range strings.Split(string(content), "\n") {
|
|
||||||
parts := strings.Split(line, " ")
|
|
||||||
if len(parts) > 1 {
|
|
||||||
if parts[0] == "nameserver" {
|
|
||||||
ns = append(ns, parts[1])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sort.Strings(ns)
|
|
||||||
newNS := strings.Join(ns, "\n")
|
|
||||||
if newNS != me.resolver.Get() {
|
|
||||||
log.Log(CHANGE, "resolver changed in /etc/resolv.conf to", ns)
|
|
||||||
me.changed = true
|
|
||||||
me.resolver.Set(newNS)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -269,21 +269,3 @@ func deleteChanges() bool {
|
||||||
|
|
||||||
return changed
|
return changed
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ls *LinuxStatus) GetIPv6() []string {
|
|
||||||
if ! me.Ready() {return nil}
|
|
||||||
tmp := me.workingIPv6.Get()
|
|
||||||
return strings.Split(tmp, "\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ls *LinuxStatus) GetIPv4() []string {
|
|
||||||
if ! me.Ready() {return nil}
|
|
||||||
tmp := me.workingIPv4.Get()
|
|
||||||
return strings.Split(tmp, "\n")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ls *LinuxStatus) GetNameservers() []string {
|
|
||||||
if ! me.Ready() {return nil}
|
|
||||||
tmp := me.resolver.Get()
|
|
||||||
return strings.Split(tmp, "\n")
|
|
||||||
}
|
|
||||||
|
|
|
@ -35,7 +35,6 @@ type LinuxStatus struct {
|
||||||
uid *gadgets.OneLiner
|
uid *gadgets.OneLiner
|
||||||
IPv4 *gadgets.OneLiner
|
IPv4 *gadgets.OneLiner
|
||||||
IPv6 *gadgets.OneLiner
|
IPv6 *gadgets.OneLiner
|
||||||
workingIPv4 *gadgets.OneLiner
|
|
||||||
workingIPv6 *gadgets.OneLiner
|
workingIPv6 *gadgets.OneLiner
|
||||||
Interfaces *gui.Node
|
Interfaces *gui.Node
|
||||||
speed *gadgets.OneLiner
|
speed *gadgets.OneLiner
|
||||||
|
|
|
@ -13,6 +13,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
"go.wit.com/shell"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CheckSuperuser() bool {
|
func CheckSuperuser() bool {
|
||||||
|
@ -88,8 +89,7 @@ func run(s string) string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trim leading and trailing whitespace from each line
|
tmp := shell.Chomp(out.String())
|
||||||
tmp := strings.TrimSpace(out.String())
|
|
||||||
// Output the results
|
// Output the results
|
||||||
log.Info("Command Output:", tmp)
|
log.Info("Command Output:", tmp)
|
||||||
|
|
||||||
|
|
26
main.go
26
main.go
|
@ -6,6 +6,8 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
"sort"
|
||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
"embed"
|
"embed"
|
||||||
|
@ -46,12 +48,7 @@ func main() {
|
||||||
me.digStatus = NewDigStatusWindow(me.myGui)
|
me.digStatus = NewDigStatusWindow(me.myGui)
|
||||||
me.statusDNS = NewHostnameStatusWindow(me.myGui)
|
me.statusDNS = NewHostnameStatusWindow(me.myGui)
|
||||||
|
|
||||||
me.statusOS = linuxstatus.New()
|
linuxstatus.New()
|
||||||
me.statusOS.SetParent(me.myGui)
|
|
||||||
me.statusOS.InitWindow()
|
|
||||||
me.statusOS.Make()
|
|
||||||
me.statusOS.Draw()
|
|
||||||
me.statusOS.Draw2()
|
|
||||||
|
|
||||||
if debugger.ArgDebug() {
|
if debugger.ArgDebug() {
|
||||||
log.Sleep(2)
|
log.Sleep(2)
|
||||||
|
@ -180,3 +177,20 @@ func timeFunction(f func()) time.Duration {
|
||||||
f() // Execute the function
|
f() // Execute the function
|
||||||
return time.Since(startTime) // Calculate the elapsed time
|
return time.Since(startTime) // Calculate the elapsed time
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sortLines takes a string, splits it on newlines, sorts the lines,
|
||||||
|
// and rejoins them with newlines.
|
||||||
|
func sortLines(input string) string {
|
||||||
|
lines := strings.Split(input, "\n")
|
||||||
|
|
||||||
|
// Trim leading and trailing whitespace from each line
|
||||||
|
for i, line := range lines {
|
||||||
|
lines[i] = strings.TrimSpace(line)
|
||||||
|
}
|
||||||
|
|
||||||
|
sort.Strings(lines)
|
||||||
|
tmp := strings.Join(lines, "\n")
|
||||||
|
tmp = strings.TrimLeft(tmp, "\n")
|
||||||
|
tmp = strings.TrimRight(tmp, "\n")
|
||||||
|
return tmp
|
||||||
|
}
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
package smartwindow
|
|
||||||
|
|
||||||
/*
|
|
||||||
this enables command line options from other packages like 'gui' and 'log'
|
|
||||||
*/
|
|
||||||
|
|
||||||
import (
|
|
||||||
"go.wit.com/log"
|
|
||||||
)
|
|
||||||
|
|
||||||
var NOW log.LogFlag
|
|
||||||
var INFO log.LogFlag
|
|
||||||
var SPEW log.LogFlag
|
|
||||||
var WARN log.LogFlag
|
|
||||||
|
|
||||||
func myreg(f *log.LogFlag, b bool, name string, desc string) {
|
|
||||||
f.B = b
|
|
||||||
f.Subsystem = "go.wit.com/gadgets/smartwindow"
|
|
||||||
f.Short = "smartWin"
|
|
||||||
f.Desc = desc
|
|
||||||
f.Name = name
|
|
||||||
f.Register()
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
myreg(&NOW, true, "NOW", "temp debugging stuff")
|
|
||||||
myreg(&INFO, false, "INFO", "normal debugging stuff")
|
|
||||||
myreg(&SPEW, false, "SPEW", "spew stuff")
|
|
||||||
myreg(&WARN, true, "WARN", "bad things")
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
// This creates a 'smart window'
|
|
||||||
// it should work even when it is hidden
|
|
||||||
// from the gui toolkit plugins
|
|
||||||
package smartwindow
|
|
||||||
|
|
||||||
import (
|
|
||||||
"go.wit.com/log"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (sw *SmartWindow) Ready() bool {
|
|
||||||
log.Log(WARN, "Ready() maybe not ready? sw =", sw)
|
|
||||||
if sw == nil {return false}
|
|
||||||
if sw == nil {return false}
|
|
||||||
if sw.window == nil {return false}
|
|
||||||
return sw.ready
|
|
||||||
}
|
|
||||||
|
|
||||||
func (sw *SmartWindow) Initialized() bool {
|
|
||||||
log.Log(WARN, "checking Initialized()")
|
|
||||||
if sw == nil {return false}
|
|
||||||
if sw == nil {return false}
|
|
||||||
if sw.parent == nil {return false}
|
|
||||||
return true
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
package smartwindow
|
|
||||||
|
|
||||||
import (
|
|
||||||
"go.wit.com/log"
|
|
||||||
|
|
||||||
"go.wit.com/gui/gadgets"
|
|
||||||
)
|
|
||||||
|
|
||||||
func New() *SmartWindow {
|
|
||||||
sw := SmartWindow {
|
|
||||||
hidden: true,
|
|
||||||
ready: false,
|
|
||||||
}
|
|
||||||
|
|
||||||
return &sw
|
|
||||||
}
|
|
||||||
|
|
||||||
func (sw *SmartWindow) InitWindow() {
|
|
||||||
if sw == nil {
|
|
||||||
log.Log(WARN, "not initalized yet (no parent for the window?)")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if sw.window != nil {
|
|
||||||
log.Log(WARN, "You already have a SmartWindow")
|
|
||||||
sw.ready = true
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Log(WARN, "Creating the Window")
|
|
||||||
sw.window = gadgets.NewBasicWindow(sw.parent, sw.title)
|
|
||||||
sw.ready = true
|
|
||||||
}
|
|
|
@ -1,59 +0,0 @@
|
||||||
// This creates a 'smart window'
|
|
||||||
// it should work even when it is hidden
|
|
||||||
// from the gui toolkit plugins
|
|
||||||
package smartwindow
|
|
||||||
|
|
||||||
import (
|
|
||||||
"go.wit.com/log"
|
|
||||||
"go.wit.com/gui/gui"
|
|
||||||
)
|
|
||||||
|
|
||||||
/*
|
|
||||||
all these functions run after the window is Ready()
|
|
||||||
so they should all start with that check
|
|
||||||
*/
|
|
||||||
|
|
||||||
// reports externally if something has changed
|
|
||||||
// since the last time it was asked about it
|
|
||||||
func (sw *SmartWindow) Changed() bool {
|
|
||||||
if ! sw.Ready() {return false}
|
|
||||||
|
|
||||||
if sw.changed {
|
|
||||||
sw.changed = false
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (sw *SmartWindow) Show() {
|
|
||||||
if ! sw.Ready() {return}
|
|
||||||
|
|
||||||
log.Log(WARN, "Show() window ready =", sw.ready)
|
|
||||||
sw.window.Show()
|
|
||||||
sw.hidden = false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (sw *SmartWindow) Hide() {
|
|
||||||
if ! sw.Ready() {return}
|
|
||||||
|
|
||||||
log.Log(WARN, "Hide() window ready =", sw.ready)
|
|
||||||
sw.window.Hide()
|
|
||||||
sw.hidden = true
|
|
||||||
}
|
|
||||||
|
|
||||||
func (sw *SmartWindow) Toggle() {
|
|
||||||
if ! sw.Ready() {return}
|
|
||||||
|
|
||||||
log.Log(WARN, "Toggle() window ready =", sw.ready)
|
|
||||||
if sw.hidden {
|
|
||||||
sw.Show()
|
|
||||||
} else {
|
|
||||||
sw.Hide()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (sw *SmartWindow) Box() *gui.Node {
|
|
||||||
if ! sw.Ready() {return nil}
|
|
||||||
|
|
||||||
return sw.window.Box()
|
|
||||||
}
|
|
|
@ -1,84 +0,0 @@
|
||||||
// these are things you can config
|
|
||||||
package smartwindow
|
|
||||||
|
|
||||||
import (
|
|
||||||
"go.wit.com/log"
|
|
||||||
"go.wit.com/gui/gui"
|
|
||||||
)
|
|
||||||
|
|
||||||
/* for now, run these before the window is ready
|
|
||||||
That is, they all start with:
|
|
||||||
|
|
||||||
if ! sw.Initialized() {return}
|
|
||||||
if sw.Ready() {return}
|
|
||||||
*/
|
|
||||||
|
|
||||||
func (sw *SmartWindow) Title(title string) {
|
|
||||||
if ! sw.Initialized() {return}
|
|
||||||
if sw.Ready() {return}
|
|
||||||
|
|
||||||
log.Log(WARN, "Title() =", title)
|
|
||||||
sw.title = title
|
|
||||||
}
|
|
||||||
|
|
||||||
func (sw *SmartWindow) SetParent(p *gui.Node) {
|
|
||||||
if ! sw.Initialized() {return}
|
|
||||||
if sw.Ready() {return}
|
|
||||||
|
|
||||||
log.Log(WARN, "SetParent")
|
|
||||||
if sw.parent == nil {
|
|
||||||
log.Log(WARN, "SetParent =", p)
|
|
||||||
sw.parent = p
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
log.Log(WARN, "SetParent was already set. TODO: Move to new parent")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (sw *SmartWindow) SetDraw(f func(*SmartWindow)) {
|
|
||||||
if ! sw.Initialized() {return}
|
|
||||||
if sw.Ready() {return}
|
|
||||||
|
|
||||||
sw.populate = f
|
|
||||||
}
|
|
||||||
|
|
||||||
func (sw *SmartWindow) Make() {
|
|
||||||
if ! sw.Initialized() {return}
|
|
||||||
if sw.Ready() {return}
|
|
||||||
|
|
||||||
log.Log(WARN, "Make() window ready =", sw.ready)
|
|
||||||
sw.window.Make()
|
|
||||||
if (sw.populate != nil) {
|
|
||||||
log.Log(WARN, "Make() trying to run Custom sw.populate() here")
|
|
||||||
sw.populate(sw)
|
|
||||||
}
|
|
||||||
sw.ready = true
|
|
||||||
}
|
|
||||||
|
|
||||||
func (sw *SmartWindow) Draw() {
|
|
||||||
if ! sw.Initialized() {return}
|
|
||||||
if sw.Ready() {return}
|
|
||||||
|
|
||||||
log.Log(WARN, "Draw() window ready =", sw.ready)
|
|
||||||
sw.window.Draw()
|
|
||||||
if (sw.populate != nil) {
|
|
||||||
log.Log(WARN, "Make() trying to run Custom sw.populate() here")
|
|
||||||
sw.populate(sw)
|
|
||||||
}
|
|
||||||
sw.ready = true
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
func (sw *SmartWindow) Vertical() {
|
|
||||||
if ! sw.Initialized() {return}
|
|
||||||
if sw.Ready() {return}
|
|
||||||
|
|
||||||
log.Log(WARN, "Draw() window ready =", sw.ready)
|
|
||||||
sw.window.Draw()
|
|
||||||
if (sw.populate != nil) {
|
|
||||||
log.Log(WARN, "Make() trying to run Custom sw.populate() here")
|
|
||||||
sw.populate(sw)
|
|
||||||
}
|
|
||||||
sw.ready = true
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
package smartwindow
|
|
||||||
|
|
||||||
import (
|
|
||||||
"go.wit.com/gui/gui"
|
|
||||||
"go.wit.com/gui/gadgets"
|
|
||||||
)
|
|
||||||
|
|
||||||
type SmartWindow struct {
|
|
||||||
ready bool // track if the window is ready
|
|
||||||
hidden bool // track if the window is hidden from the toolkits
|
|
||||||
changed bool // track if something changed in the window
|
|
||||||
|
|
||||||
title string // what the user sees as the name
|
|
||||||
name string // the programatic name aka: "CALANDAR"
|
|
||||||
|
|
||||||
parent *gui.Node // where to place the window if you try to draw it
|
|
||||||
window *gadgets.BasicWindow // the underlying BasicWindow
|
|
||||||
box *gui.Node // the box inside the window // get this from BasicWindow() ?
|
|
||||||
|
|
||||||
populate func(*SmartWindow) // the function to generate the widgets
|
|
||||||
}
|
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"go.wit.com/gui/gadgets"
|
"go.wit.com/gui/gadgets"
|
||||||
// "go.wit.com/gui/cloudflare"
|
// "go.wit.com/gui/cloudflare"
|
||||||
"go.wit.com/control-panels/dns/linuxstatus"
|
"go.wit.com/control-panels/dns/linuxstatus"
|
||||||
"go.wit.com/control-panels/dns/smartwindow"
|
|
||||||
|
|
||||||
"github.com/miekg/dns"
|
"github.com/miekg/dns"
|
||||||
)
|
)
|
||||||
|
@ -59,10 +58,7 @@ type Host struct {
|
||||||
|
|
||||||
statusIPv6 *gadgets.OneLiner
|
statusIPv6 *gadgets.OneLiner
|
||||||
digStatusButton *gui.Node
|
digStatusButton *gui.Node
|
||||||
statusDNSbutton *gui.Node
|
|
||||||
witcom *gadgets.BasicWindow
|
witcom *gadgets.BasicWindow
|
||||||
fixButton *gui.Node
|
|
||||||
fixWindow *smartwindow.SmartWindow
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type IPtype struct {
|
type IPtype struct {
|
||||||
|
|
Loading…
Reference in New Issue