Compare commits
No commits in common. "d2fb88cd584b8e7e60cb6315d9fb8d0d6ceac22f" and "ca3a01f478aa60fb039892d2cae6823188b5842c" have entirely different histories.
d2fb88cd58
...
ca3a01f478
68
gui.go
68
gui.go
|
@ -101,11 +101,6 @@ func debugTab(title string) {
|
||||||
// log.Println(o)
|
// log.Println(o)
|
||||||
})
|
})
|
||||||
|
|
||||||
g2.NewButton("getProcessNameByPort()", func () {
|
|
||||||
processName := 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
|
||||||
|
@ -194,39 +189,25 @@ func myDefaultExit(n *gui.Node) {
|
||||||
func mainWindow(title string) {
|
func mainWindow(title string) {
|
||||||
me.window = gadgets.NewBasicWindow(me.myGui, title)
|
me.window = gadgets.NewBasicWindow(me.myGui, title)
|
||||||
|
|
||||||
gr := me.window.Box().NewGroup("dns update")
|
me.mainStatus = me.window.Box().NewGroup("dns update")
|
||||||
grid := gr.NewGrid("gridnuts", 2, 2)
|
grid := me.mainStatus.NewGrid("gridnuts", 2, 2)
|
||||||
|
|
||||||
grid.SetNext(1,1)
|
grid.SetNext(1,1)
|
||||||
|
|
||||||
grid.NewLabel("hostname =")
|
grid.NewLabel("hostname =")
|
||||||
me.fqdn = grid.NewLabel("?")
|
me.fqdn = grid.NewLabel("?")
|
||||||
|
|
||||||
|
// grid.NewLabel("DNS AAAA =")
|
||||||
me.DnsAAAA = gadgets.NewOneLiner(grid, "DNS AAAA =").Set("unknown")
|
me.DnsAAAA = gadgets.NewOneLiner(grid, "DNS AAAA =").Set("unknown")
|
||||||
|
|
||||||
grid.NewLabel("DNS A =")
|
grid.NewLabel("DNS A =")
|
||||||
me.DnsA = grid.NewLabel("?")
|
me.DnsA = grid.NewLabel("?")
|
||||||
|
|
||||||
// This is where you figure out what to do next to fix the problems
|
me.digStatus = NewDigStatusWindow(me.myGui)
|
||||||
gr.NewButton("fix", func () {
|
me.status = NewHostnameStatusWindow(me.myGui)
|
||||||
if ! me.status.Ready() {
|
|
||||||
log.Warn("The IPv6 Control Panel is not Ready() yet")
|
me.hostnameStatusButton = me.mainStatus.NewButton("Fix hostname DNS", func () {
|
||||||
return
|
me.status.window.Toggle()
|
||||||
}
|
|
||||||
if me.status.ValidHostname() {
|
|
||||||
log.Warn("Your hostname is VALID:", me.status.GetHostname())
|
|
||||||
} else {
|
|
||||||
log.Warn("You must first fix your hostname:", me.status.GetHostname())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if ! me.status.IPv4() {
|
|
||||||
log.Warn("You do not have real IPv4 addresses. Nothing to fix here")
|
|
||||||
}
|
|
||||||
if ! me.status.IPv6() {
|
|
||||||
log.Warn("IPv6 DNS is broken. Check what is broken here")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
log.Warn("FIGURE OUT WHAT TO DO HERE")
|
|
||||||
})
|
})
|
||||||
|
|
||||||
grid.Margin()
|
grid.Margin()
|
||||||
|
@ -234,23 +215,15 @@ func mainWindow(title string) {
|
||||||
|
|
||||||
statusGrid(me.window.Box())
|
statusGrid(me.window.Box())
|
||||||
|
|
||||||
gr = me.window.Box().NewGroup("debugging")
|
gr := me.window.Box().NewGroup("debugging")
|
||||||
gr.NewButton("hostname status", func () {
|
gr.NewButton("OS Details", func () {
|
||||||
if ! me.status.Ready() {return}
|
|
||||||
me.status.window.Toggle()
|
|
||||||
})
|
|
||||||
|
|
||||||
gr.NewButton("OS details", func () {
|
|
||||||
me.details.Toggle()
|
me.details.Toggle()
|
||||||
})
|
})
|
||||||
gr.NewButton("resolver status", func () {
|
gr.NewButton("Resolver Status", func () {
|
||||||
if ! me.digStatus.Ready() {return}
|
if ! me.digStatus.Ready() {return}
|
||||||
me.digStatus.window.Toggle()
|
me.digStatus.window.Toggle()
|
||||||
})
|
})
|
||||||
gr.NewButton("cloudflare wit.com", func () {
|
gr.NewButton("Control Panel Debug", func () {
|
||||||
cloudflare.CreateRR(me.myGui, "wit.com", "3777302ac4a78cd7fa4f6d3f72086d06")
|
|
||||||
})
|
|
||||||
gr.NewButton("Debug", func () {
|
|
||||||
me.debug.Toggle()
|
me.debug.Toggle()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -372,3 +345,20 @@ func updateDNS() {
|
||||||
|
|
||||||
log.Println("updateDNS() END")
|
log.Println("updateDNS() END")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func suggestProcDebugging() {
|
||||||
|
if (me.fixProc != nil) {
|
||||||
|
// me.fixProc.Disable()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
me.fixProc = me.mainStatus.NewButton("Try debugging Slow DNS lookups", func () {
|
||||||
|
log.Warn("You're DNS lookups are very slow")
|
||||||
|
me.dbOn.Set(true)
|
||||||
|
me.dbProc.Set(true)
|
||||||
|
|
||||||
|
processName := getProcessNameByPort(53)
|
||||||
|
log.Info("Process with port 53:", processName)
|
||||||
|
})
|
||||||
|
// me.fixProc.Disable()
|
||||||
|
}
|
||||||
|
|
11
hostname.go
11
hostname.go
|
@ -7,7 +7,7 @@ import (
|
||||||
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
"go.wit.com/shell"
|
"go.wit.com/shell"
|
||||||
// "go.wit.com/gui/cloudflare"
|
"go.wit.com/gui/cloudflare"
|
||||||
|
|
||||||
"github.com/miekg/dns"
|
"github.com/miekg/dns"
|
||||||
// will try to get this hosts FQDN
|
// will try to get this hosts FQDN
|
||||||
|
@ -53,6 +53,15 @@ func getHostname() {
|
||||||
me.hostnameStatus.SetText("VALID")
|
me.hostnameStatus.SetText("VALID")
|
||||||
me.changed = true
|
me.changed = true
|
||||||
}
|
}
|
||||||
|
// enable the cloudflare button if the provider is cloudflare
|
||||||
|
if (me.cloudflareB == nil) {
|
||||||
|
log.Log(CHANGE, "me.cloudflare == nil; me.DnsAPI.S =", me.DnsAPI.S)
|
||||||
|
if (me.DnsAPI.S == "cloudflare") {
|
||||||
|
me.cloudflareB = me.mainStatus.NewButton("cloudflare wit.com", func () {
|
||||||
|
cloudflare.CreateRR(me.myGui, "wit.com", "3777302ac4a78cd7fa4f6d3f72086d06")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import (
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
"go.wit.com/gui/gui"
|
"go.wit.com/gui/gui"
|
||||||
"go.wit.com/gui/gadgets"
|
"go.wit.com/gui/gadgets"
|
||||||
|
"go.wit.com/gui/cloudflare"
|
||||||
)
|
)
|
||||||
|
|
||||||
type hostnameStatus struct {
|
type hostnameStatus struct {
|
||||||
|
@ -50,8 +51,8 @@ type hostnameStatus struct {
|
||||||
speedActual *gadgets.OneLiner
|
speedActual *gadgets.OneLiner
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
// dnsValue *gui.Node
|
dnsValue *gui.Node
|
||||||
// dnsAction *gui.Node
|
dnsAction *gui.Node
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewHostnameStatusWindow(p *gui.Node) *hostnameStatus {
|
func NewHostnameStatusWindow(p *gui.Node) *hostnameStatus {
|
||||||
|
@ -94,7 +95,6 @@ func NewHostnameStatusWindow(p *gui.Node) *hostnameStatus {
|
||||||
group.Pad()
|
group.Pad()
|
||||||
grid.Pad()
|
grid.Pad()
|
||||||
|
|
||||||
/*
|
|
||||||
group = hs.window.Box().NewGroup("Actions")
|
group = hs.window.Box().NewGroup("Actions")
|
||||||
grid = group.NewGrid("LookupDetails", 2, 2)
|
grid = group.NewGrid("LookupDetails", 2, 2)
|
||||||
|
|
||||||
|
@ -108,7 +108,6 @@ func NewHostnameStatusWindow(p *gui.Node) *hostnameStatus {
|
||||||
hs.createDNSrecord(hs.dnsValue.S)
|
hs.createDNSrecord(hs.dnsValue.S)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
*/
|
|
||||||
|
|
||||||
group.Pad()
|
group.Pad()
|
||||||
grid.Pad()
|
grid.Pad()
|
||||||
|
@ -147,7 +146,6 @@ func (hs *hostnameStatus) API() string {
|
||||||
return hs.dnsAPI.Get()
|
return hs.dnsAPI.Get()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
func (hs *hostnameStatus) deleteDNSrecord(value string) bool {
|
func (hs *hostnameStatus) deleteDNSrecord(value string) bool {
|
||||||
log.Info("deleteDNSrecord() START for", value)
|
log.Info("deleteDNSrecord() START for", value)
|
||||||
log.Info("deleteDNSrecord() hostname =", me.status.GetHostname())
|
log.Info("deleteDNSrecord() hostname =", me.status.GetHostname())
|
||||||
|
@ -173,7 +171,6 @@ func (hs *hostnameStatus) createDNSrecord(value string) bool {
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
func (hs *hostnameStatus) Update() {
|
func (hs *hostnameStatus) Update() {
|
||||||
log.Info("hostnameStatus() Update() START")
|
log.Info("hostnameStatus() Update() START")
|
||||||
|
@ -269,7 +266,6 @@ func (hs *hostnameStatus) existsAAAA(s string) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// figure out if I'm missing any IPv6 address in DNS
|
// figure out if I'm missing any IPv6 address in DNS
|
||||||
func (hs *hostnameStatus) missingAAAA() bool {
|
func (hs *hostnameStatus) missingAAAA() bool {
|
||||||
var aaaa []string
|
var aaaa []string
|
||||||
|
@ -288,7 +284,6 @@ func (hs *hostnameStatus) missingAAAA() bool {
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
func (hs *hostnameStatus) updateStatus() {
|
func (hs *hostnameStatus) updateStatus() {
|
||||||
if ! hs.Ready() { return }
|
if ! hs.Ready() { return }
|
||||||
|
@ -307,17 +302,15 @@ func (hs *hostnameStatus) updateStatus() {
|
||||||
s = "(none)"
|
s = "(none)"
|
||||||
} else {
|
} else {
|
||||||
hs.setIPv6("Check for real IPv6 addresses here")
|
hs.setIPv6("Check for real IPv6 addresses here")
|
||||||
/*
|
|
||||||
if hs.missingAAAA() {
|
if hs.missingAAAA() {
|
||||||
hs.setIPv6("Add the missing IPv6 address")
|
hs.setIPv6("Add the missing IPv6 address")
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
for _, addr := range vals {
|
for _, addr := range vals {
|
||||||
log.Log(STATUS, addr)
|
log.Log(STATUS, addr)
|
||||||
s += addr + " (DELETE)" + "\n"
|
s += addr + " (DELETE)" + "\n"
|
||||||
hs.setIPv6("NEEDS DELETE")
|
hs.setIPv6("NEEDS DELETE")
|
||||||
// hs.dnsValue.SetText(addr)
|
hs.dnsValue.SetText(addr)
|
||||||
// hs.dnsAction.SetText("DELETE")
|
hs.dnsAction.SetText("DELETE")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hs.set(hs.dnsAAAA, s)
|
hs.set(hs.dnsAAAA, s)
|
||||||
|
|
16
main.go
16
main.go
|
@ -44,9 +44,6 @@ func main() {
|
||||||
log.Sleep(me.artificialSleep)
|
log.Sleep(me.artificialSleep)
|
||||||
setupControlPanelWindow()
|
setupControlPanelWindow()
|
||||||
|
|
||||||
me.digStatus = NewDigStatusWindow(me.myGui)
|
|
||||||
me.status = NewHostnameStatusWindow(me.myGui)
|
|
||||||
|
|
||||||
if debugger.ArgDebug() {
|
if debugger.ArgDebug() {
|
||||||
log.Sleep(2)
|
log.Sleep(2)
|
||||||
debugger.DebugWindow(me.myGui)
|
debugger.DebugWindow(me.myGui)
|
||||||
|
@ -124,15 +121,24 @@ func DNSloop() {
|
||||||
log.Info("dnsTTL() execution Time: ", duration)
|
log.Info("dnsTTL() execution Time: ", duration)
|
||||||
var s, newSpeed string
|
var s, newSpeed string
|
||||||
if (duration > 5000 * time.Millisecond ) {
|
if (duration > 5000 * time.Millisecond ) {
|
||||||
newSpeed = "VERY SLOW"
|
newSpeed = "VERY BAD"
|
||||||
|
suggestProcDebugging()
|
||||||
} else if (duration > 2000 * time.Millisecond ) {
|
} else if (duration > 2000 * time.Millisecond ) {
|
||||||
newSpeed = "SLOWER"
|
newSpeed = "BAD"
|
||||||
|
suggestProcDebugging()
|
||||||
} else if (duration > 500 * time.Millisecond ) {
|
} else if (duration > 500 * time.Millisecond ) {
|
||||||
|
suggestProcDebugging()
|
||||||
newSpeed = "SLOW"
|
newSpeed = "SLOW"
|
||||||
} else if (duration > 100 * time.Millisecond ) {
|
} else if (duration > 100 * time.Millisecond ) {
|
||||||
newSpeed = "OK"
|
newSpeed = "OK"
|
||||||
|
if (me.fixProc != nil) {
|
||||||
|
// me.fixProc.Disable()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
newSpeed = "FAST"
|
newSpeed = "FAST"
|
||||||
|
if (me.fixProc != nil) {
|
||||||
|
// me.fixProc.Disable()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (newSpeed != me.DnsSpeedLast) {
|
if (newSpeed != me.DnsSpeedLast) {
|
||||||
log.Log(CHANGE, "dns lookup speed changed =", newSpeed)
|
log.Log(CHANGE, "dns lookup speed changed =", newSpeed)
|
||||||
|
|
18
structs.go
18
structs.go
|
@ -18,9 +18,13 @@ type Host struct {
|
||||||
|
|
||||||
hostnameStatus *gui.Node // a summary for the user of where things are
|
hostnameStatus *gui.Node // a summary for the user of where things are
|
||||||
|
|
||||||
|
// hostname string // mirrors
|
||||||
domainname *gui.Node // kernel.org
|
domainname *gui.Node // kernel.org
|
||||||
hostshort *gui.Node // hostname -s
|
hostshort *gui.Node // hostname -s
|
||||||
|
// fqdn string // mirrors.kernel.org
|
||||||
|
|
||||||
|
// dnsTTL int `default:"3"` // Recheck DNS is working every TTL (in seconds)
|
||||||
|
// dnsTTLsleep float64 // sleep between loops
|
||||||
artificialSleep float64 `default:"0.7"` // artificial sleep on startup
|
artificialSleep float64 `default:"0.7"` // artificial sleep on startup
|
||||||
artificialS string `default:"abc"` // artificial sleep on startup
|
artificialS string `default:"abc"` // artificial sleep on startup
|
||||||
|
|
||||||
|
@ -67,16 +71,22 @@ type Host struct {
|
||||||
DnsSpeedActual *gui.Node // the last actual duration
|
DnsSpeedActual *gui.Node // the last actual duration
|
||||||
DnsSpeedLast string // the last state 'FAST', 'OK', etc
|
DnsSpeedLast string // the last state 'FAST', 'OK', etc
|
||||||
|
|
||||||
// fix *gui.Node // button for the user to click
|
fix *gui.Node // button for the user to click
|
||||||
// fixProc *gui.Node // button for the user to click
|
fixProc *gui.Node // button for the user to click
|
||||||
|
|
||||||
// mainStatus *gui.Node // group for the main display of stuff
|
mainStatus *gui.Node // group for the main display of stuff
|
||||||
// cloudflareB *gui.Node // cloudflare button
|
cloudflareB *gui.Node // cloudflare button
|
||||||
|
|
||||||
|
dbOn *gui.Node // button for setting debugging on
|
||||||
|
dbNet *gui.Node // button for setting network debugging on
|
||||||
|
dbProc *gui.Node // button for setting proc debugging on
|
||||||
|
|
||||||
digStatus *digStatus
|
digStatus *digStatus
|
||||||
statusIPv6 *gadgets.OneLiner
|
statusIPv6 *gadgets.OneLiner
|
||||||
digStatusButton *gui.Node
|
digStatusButton *gui.Node
|
||||||
|
|
||||||
|
hostnameStatusButton *gui.Node
|
||||||
|
|
||||||
myDebug *gui.Node
|
myDebug *gui.Node
|
||||||
myGui *gui.Node
|
myGui *gui.Node
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue