2023-02-08 11:04:04 -06:00
|
|
|
// This creates a simple hello world window
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2023-04-07 11:23:47 -05:00
|
|
|
"fmt"
|
2023-12-21 17:56:56 -06:00
|
|
|
"time"
|
2023-02-08 11:04:04 -06:00
|
|
|
"os"
|
2023-02-09 09:07:00 -06:00
|
|
|
"os/user"
|
2023-03-25 08:40:48 -05:00
|
|
|
"strconv"
|
2023-02-09 09:07:00 -06:00
|
|
|
"net"
|
2023-12-20 03:13:43 -06:00
|
|
|
"strings"
|
|
|
|
|
2023-12-20 15:12:26 -06:00
|
|
|
"go.wit.com/gui"
|
2023-12-29 02:43:00 -06:00
|
|
|
"go.wit.com/gui/gadgets"
|
2023-12-28 15:36:05 -06:00
|
|
|
"go.wit.com/log"
|
2023-12-20 15:12:26 -06:00
|
|
|
"go.wit.com/shell"
|
2023-12-21 17:56:56 -06:00
|
|
|
"go.wit.com/control-panel-dns/cloudflare"
|
2023-02-08 11:04:04 -06:00
|
|
|
)
|
|
|
|
|
2023-04-07 11:23:47 -05:00
|
|
|
// This setups up the dns control panel window
|
|
|
|
func setupControlPanelWindow() {
|
2023-12-20 03:13:43 -06:00
|
|
|
me.window = myGui.NewWindow("DNS and IPv6 Control Panel")
|
|
|
|
// me.window.Dump() // will dump out some info
|
2023-03-25 22:45:48 -05:00
|
|
|
|
2023-12-20 03:13:43 -06:00
|
|
|
debug("artificial sleep of:", me.artificialSleep)
|
2023-12-16 12:59:18 -06:00
|
|
|
sleep(me.artificialSleep)
|
2023-12-28 09:43:45 -06:00
|
|
|
|
|
|
|
// setup the main tab
|
2023-12-16 09:02:59 -06:00
|
|
|
dnsTab("DNS")
|
2023-12-20 03:13:43 -06:00
|
|
|
detailsTab("Details")
|
2023-12-16 09:02:59 -06:00
|
|
|
debugTab("Debug")
|
2023-12-28 09:43:45 -06:00
|
|
|
|
2023-12-28 15:36:05 -06:00
|
|
|
// me.digStatus = NewDigStatusWindow(me.window)
|
2023-12-20 03:13:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func detailsTab(title string) {
|
|
|
|
var g2 *gui.Node
|
|
|
|
|
|
|
|
tab := me.window.NewTab(title)
|
|
|
|
|
|
|
|
g2 = tab.NewGroup("Real Stuff")
|
|
|
|
|
|
|
|
grid := g2.NewGrid("gridnuts", 2, 2)
|
|
|
|
|
|
|
|
grid.SetNext(1,1)
|
|
|
|
|
|
|
|
grid.NewLabel("domainname =")
|
|
|
|
me.domainname = grid.NewLabel("domainname")
|
2023-02-08 11:04:04 -06:00
|
|
|
|
2023-12-20 03:13:43 -06:00
|
|
|
grid.NewLabel("hostname -s =")
|
|
|
|
me.hostshort = grid.NewLabel("hostname -s")
|
|
|
|
|
|
|
|
grid.NewLabel("NS records =")
|
|
|
|
me.NSrr = grid.NewLabel("NS RR's")
|
|
|
|
|
|
|
|
grid.NewLabel("UID =")
|
|
|
|
me.uid = grid.NewLabel("my uid")
|
|
|
|
|
|
|
|
grid.NewLabel("Current IPv4 =")
|
|
|
|
me.IPv4 = grid.NewLabel("?")
|
|
|
|
|
|
|
|
grid.NewLabel("Current IPv6 =")
|
|
|
|
me.IPv6 = grid.NewLabel("?")
|
|
|
|
|
2023-12-28 09:43:45 -06:00
|
|
|
grid.NewLabel("Working Real IPv6 =")
|
|
|
|
me.workingIPv6 = grid.NewLabel("?")
|
|
|
|
|
2023-12-20 03:13:43 -06:00
|
|
|
grid.NewLabel("interfaces =")
|
|
|
|
me.Interfaces = grid.NewCombobox("Interfaces")
|
|
|
|
|
|
|
|
grid.NewLabel("refresh speed")
|
|
|
|
me.LocalSpeedActual = grid.NewLabel("unknown")
|
|
|
|
|
|
|
|
tab.Margin()
|
|
|
|
tab.Pad()
|
|
|
|
|
|
|
|
grid.Margin()
|
|
|
|
grid.Pad()
|
2023-02-08 11:04:04 -06:00
|
|
|
}
|
|
|
|
|
2023-12-16 09:02:59 -06:00
|
|
|
func debugTab(title string) {
|
2023-03-01 11:21:47 -06:00
|
|
|
var g2 *gui.Node
|
2023-02-08 11:04:04 -06:00
|
|
|
|
2023-12-16 09:02:59 -06:00
|
|
|
tab := me.window.NewTab(title)
|
2023-02-08 11:04:04 -06:00
|
|
|
|
2023-12-16 09:02:59 -06:00
|
|
|
g2 = tab.NewGroup("Real Stuff")
|
2023-02-08 11:04:04 -06:00
|
|
|
|
2023-03-26 16:17:32 -05:00
|
|
|
g2.NewButton("gui.DebugWindow()", func () {
|
|
|
|
gui.DebugWindow()
|
|
|
|
})
|
2023-04-07 11:23:47 -05:00
|
|
|
|
|
|
|
g2.NewButton("Load 'gocui'", func () {
|
|
|
|
// this set the xterm and mate-terminal window title. maybe works generally?
|
|
|
|
fmt.Println("\033]0;" + title + "blah \007")
|
2023-04-13 07:49:13 -05:00
|
|
|
myGui.LoadToolkit("gocui")
|
2023-04-07 11:23:47 -05:00
|
|
|
})
|
|
|
|
|
2023-02-18 23:37:11 -06:00
|
|
|
g2.NewButton("Network Interfaces", func () {
|
|
|
|
for i, t := range me.ifmap {
|
2023-12-16 09:02:59 -06:00
|
|
|
log.Println("name =", t.iface.Name)
|
|
|
|
log.Println("int =", i, "name =", t.name, t.iface)
|
|
|
|
log.Println("iface = " + t.iface.Name)
|
2023-02-18 23:37:11 -06:00
|
|
|
}
|
2023-02-09 09:07:00 -06:00
|
|
|
})
|
2023-12-20 03:13:43 -06:00
|
|
|
|
2023-02-18 23:37:11 -06:00
|
|
|
g2.NewButton("Hostname", func () {
|
|
|
|
getHostname()
|
|
|
|
})
|
2023-12-20 03:13:43 -06:00
|
|
|
|
|
|
|
g2.NewButton("Actual AAAA & A", func () {
|
|
|
|
displayDNS() // doesn't re-query anything
|
2023-02-18 23:37:11 -06:00
|
|
|
})
|
2023-03-01 11:21:47 -06:00
|
|
|
|
2023-12-20 03:13:43 -06:00
|
|
|
g2.NewButton("dig A & AAAA DNS records", func () {
|
2023-12-16 09:02:59 -06:00
|
|
|
log.Println("updateDNS()")
|
2023-04-13 07:49:13 -05:00
|
|
|
updateDNS()
|
|
|
|
})
|
|
|
|
|
2023-12-20 03:13:43 -06:00
|
|
|
g2.NewButton("checkDNS:", func () {
|
|
|
|
ipv6s, ipv4s := checkDNS()
|
|
|
|
for s, _ := range ipv6s {
|
|
|
|
debug(LogNow, "check if", s, "is in DNS")
|
|
|
|
}
|
|
|
|
for s, _ := range ipv4s {
|
|
|
|
debug(LogNow, "check if", s, "is in DNS")
|
|
|
|
}
|
2023-02-09 09:07:00 -06:00
|
|
|
})
|
2023-12-20 03:13:43 -06:00
|
|
|
|
2023-02-09 09:07:00 -06:00
|
|
|
g2.NewButton("os.User()", func () {
|
|
|
|
user, _ := user.Current()
|
2023-12-16 09:02:59 -06:00
|
|
|
log.Println("os.Getuid =", user.Username, os.Getuid())
|
2023-03-25 08:40:48 -05:00
|
|
|
if (me.uid != nil) {
|
|
|
|
me.uid.SetText(user.Username + " (" + strconv.Itoa(os.Getuid()) + ")")
|
|
|
|
}
|
2023-02-18 23:37:11 -06:00
|
|
|
})
|
2023-12-20 03:13:43 -06:00
|
|
|
|
2023-03-25 16:19:44 -05:00
|
|
|
g2.NewButton("dig +trace", func () {
|
|
|
|
o := shell.Run("dig +trace +noadditional DS " + me.hostname + " @8.8.8.8")
|
2023-12-16 09:02:59 -06:00
|
|
|
log.Println(o)
|
2023-03-25 16:19:44 -05:00
|
|
|
})
|
2023-12-20 03:13:43 -06:00
|
|
|
|
2023-02-18 23:37:11 -06:00
|
|
|
g2.NewButton("Example_listLink()", func () {
|
|
|
|
Example_listLink()
|
2023-02-09 09:07:00 -06:00
|
|
|
})
|
2023-12-20 03:13:43 -06:00
|
|
|
|
2023-02-09 09:07:00 -06:00
|
|
|
g2.NewButton("Escalate()", func () {
|
|
|
|
Escalate()
|
|
|
|
})
|
2023-12-20 03:13:43 -06:00
|
|
|
|
2023-02-09 09:07:00 -06:00
|
|
|
g2.NewButton("LookupAddr(<raw ipv6>) == fire from /etc/hosts", func () {
|
|
|
|
host, err := net.LookupAddr("2600:1700:afd5:6000:b26e:bfff:fe80:3c52")
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
2023-12-16 09:02:59 -06:00
|
|
|
log.Println("host =", host)
|
2023-02-09 09:07:00 -06:00
|
|
|
})
|
2023-12-20 03:13:43 -06:00
|
|
|
|
2023-02-09 09:07:00 -06:00
|
|
|
g2.NewButton("DumpPublicDNSZone(apple.com)", func () {
|
|
|
|
DumpPublicDNSZone("apple.com")
|
2023-02-09 19:47:52 -06:00
|
|
|
dumpIPs("www.apple.com")
|
2023-02-09 09:07:00 -06:00
|
|
|
})
|
2023-12-16 12:59:18 -06:00
|
|
|
|
2023-12-20 03:13:43 -06:00
|
|
|
g2 = tab.NewGroup("debugging options")
|
|
|
|
|
|
|
|
// DEBUG flags
|
|
|
|
me.dbOn = g2.NewCheckbox("turn on debugging (will override all flags below)")
|
|
|
|
me.dbOn.Custom = func() {
|
|
|
|
DEBUGON = me.dbOn.B
|
|
|
|
}
|
|
|
|
|
|
|
|
me.dbNet = g2.NewCheckbox("turn on network debugging)")
|
|
|
|
me.dbNet.Custom = func() {
|
|
|
|
LogNet = me.dbNet.B
|
|
|
|
}
|
|
|
|
|
|
|
|
me.dbProc = g2.NewCheckbox("turn on /proc debugging)")
|
|
|
|
me.dbProc.Custom = func() {
|
|
|
|
LogProc = me.dbProc.B
|
|
|
|
}
|
|
|
|
|
2023-12-21 17:56:56 -06:00
|
|
|
// makes a slider widget
|
2023-12-29 02:43:00 -06:00
|
|
|
me.ttl = gadgets.NewDurationSlider(g2, "Loop Timeout", 10 * time.Millisecond, 5 * time.Second)
|
2023-12-21 17:56:56 -06:00
|
|
|
me.ttl.Set(300 * time.Millisecond)
|
2023-12-16 12:59:18 -06:00
|
|
|
|
2023-12-21 17:56:56 -06:00
|
|
|
// makes a slider widget
|
2023-12-29 02:43:00 -06:00
|
|
|
me.dnsTtl = gadgets.NewDurationSlider(g2, "DNS Timeout", 800 * time.Millisecond, 300 * time.Second)
|
2023-12-21 17:56:56 -06:00
|
|
|
me.dnsTtl.Set(60 * time.Second)
|
2023-12-20 03:13:43 -06:00
|
|
|
|
|
|
|
g2.Margin()
|
|
|
|
g2.Pad()
|
|
|
|
}
|
|
|
|
|
2023-12-28 09:43:45 -06:00
|
|
|
// 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 {
|
|
|
|
debug(LogNow, "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 {
|
|
|
|
debug(LogNow, "missing AAAA =", s)
|
|
|
|
return s
|
|
|
|
}
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
2023-12-20 03:13:43 -06:00
|
|
|
// doesn't actually do any network traffic
|
|
|
|
// it just updates the GUI
|
2023-12-28 09:43:45 -06:00
|
|
|
func displayDNS() string {
|
2023-12-20 03:13:43 -06:00
|
|
|
var aaaa []string
|
2023-12-28 09:43:45 -06:00
|
|
|
aaaa = dhcpAAAA() // your AAAA records right now
|
2023-12-20 03:13:43 -06:00
|
|
|
h := me.hostname
|
|
|
|
var all string
|
2023-12-28 09:43:45 -06:00
|
|
|
var broken string = "unknown"
|
2023-12-20 03:13:43 -06:00
|
|
|
for _, s := range aaaa {
|
|
|
|
debug(LogNow, "host", h, "DNS AAAA =", s, "ipmap[s] =", me.ipmap[s])
|
|
|
|
all += s + "\n"
|
|
|
|
if ( me.ipmap[s] == nil) {
|
|
|
|
debug(LogError, "THIS IS THE WRONG AAAA DNS ENTRY: host", h, "DNS AAAA =", s)
|
2023-12-28 09:43:45 -06:00
|
|
|
broken = "wrong AAAA entry"
|
2023-12-20 03:13:43 -06:00
|
|
|
} else {
|
2023-12-28 09:43:45 -06:00
|
|
|
if (broken == "unknown") {
|
|
|
|
broken = "needs update"
|
2023-12-20 03:13:43 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
all = sortLines(all)
|
2023-12-28 09:43:45 -06:00
|
|
|
if (me.workingIPv6.S != all) {
|
|
|
|
debug(LogError, "workingIPv6.SetText() to:", all)
|
|
|
|
me.workingIPv6.SetText(all)
|
2023-12-20 03:13:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
var a []string
|
|
|
|
a = realA()
|
|
|
|
all = sortLines(strings.Join(a, "\n"))
|
|
|
|
if (all == "") {
|
|
|
|
debug(LogInfo, "THERE IS NOT a real A DNS ENTRY")
|
|
|
|
all = "CNAME ipv6.wit.com"
|
|
|
|
}
|
|
|
|
if (me.DnsA.S != all) {
|
|
|
|
debug(LogError, "DnsA.SetText() to:", all)
|
|
|
|
me.DnsA.SetText(all)
|
|
|
|
}
|
|
|
|
return broken
|
2023-02-08 11:04:04 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func myDefaultExit(n *gui.Node) {
|
2023-12-16 09:02:59 -06:00
|
|
|
log.Println("You can Do exit() things here")
|
2023-02-08 11:04:04 -06:00
|
|
|
os.Exit(0)
|
|
|
|
}
|
2023-03-01 11:21:47 -06:00
|
|
|
|
2023-12-16 09:02:59 -06:00
|
|
|
func dnsTab(title string) {
|
|
|
|
tab := me.window.NewTab(title)
|
|
|
|
|
2023-12-20 03:13:43 -06:00
|
|
|
me.mainStatus = tab.NewGroup("dns update")
|
2023-03-25 08:09:34 -05:00
|
|
|
|
2023-12-20 03:13:43 -06:00
|
|
|
grid := me.mainStatus.NewGrid("gridnuts", 2, 2)
|
2023-03-25 08:09:34 -05:00
|
|
|
|
|
|
|
grid.SetNext(1,1)
|
2023-12-20 03:13:43 -06:00
|
|
|
|
2023-03-25 08:09:34 -05:00
|
|
|
grid.NewLabel("hostname =")
|
2023-03-25 16:19:44 -05:00
|
|
|
me.fqdn = grid.NewLabel("?")
|
|
|
|
me.hostname = ""
|
2023-03-25 08:09:34 -05:00
|
|
|
|
2023-03-25 16:19:44 -05:00
|
|
|
grid.NewLabel("DNS AAAA =")
|
|
|
|
me.DnsAAAA = grid.NewLabel("?")
|
|
|
|
|
|
|
|
grid.NewLabel("DNS A =")
|
|
|
|
me.DnsA = grid.NewLabel("?")
|
|
|
|
|
2023-12-20 03:13:43 -06:00
|
|
|
me.fix = me.mainStatus.NewButton("Fix", func () {
|
2023-12-16 09:02:59 -06:00
|
|
|
if (goodHostname(me.hostname)) {
|
2023-12-20 03:13:43 -06:00
|
|
|
debug(LogInfo, "hostname is good:", me.hostname)
|
2023-12-16 09:02:59 -06:00
|
|
|
} else {
|
2023-12-20 03:13:43 -06:00
|
|
|
debug(LogError, "FIX: you need to fix your hostname here", me.hostname)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
// check to see if the cloudflare window exists
|
|
|
|
/*
|
|
|
|
if (me.cloudflareW != nil) {
|
|
|
|
newRR.NameNode.SetText(me.hostname)
|
|
|
|
newRR.TypeNode.SetText("AAAA")
|
|
|
|
for s, t := range me.ipmap {
|
|
|
|
if (t.IsReal()) {
|
|
|
|
if (t.ipv6) {
|
|
|
|
newRR.ValueNode.SetText(s)
|
|
|
|
cloudflare.CreateCurlRR()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cloudflare.CreateCurlRR()
|
2023-12-16 09:02:59 -06:00
|
|
|
return
|
2023-12-20 03:13:43 -06:00
|
|
|
} else {
|
|
|
|
// nsupdate()
|
|
|
|
// me.fixProc.Disable()
|
2023-12-16 09:02:59 -06:00
|
|
|
}
|
2023-12-20 03:13:43 -06:00
|
|
|
*/
|
2023-03-01 11:21:47 -06:00
|
|
|
})
|
2023-12-16 09:02:59 -06:00
|
|
|
me.fix.Disable()
|
|
|
|
|
2023-12-29 01:36:10 -06:00
|
|
|
me.digStatusButton = me.mainStatus.NewButton("Resolver Status", func () {
|
2023-12-28 15:36:05 -06:00
|
|
|
if (me.digStatus == nil) {
|
|
|
|
log.Info("drawing the digStatus window START")
|
2023-12-29 01:36:10 -06:00
|
|
|
me.digStatus = NewDigStatusWindow(myGui)
|
2023-12-28 15:36:05 -06:00
|
|
|
log.Info("drawing the digStatus window END")
|
|
|
|
me.digStatusButton.SetText("Hide DNS Lookup Status")
|
2023-12-29 01:36:10 -06:00
|
|
|
me.digStatus.Update()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if me.digStatus.hidden {
|
|
|
|
me.digStatusButton.SetText("Hide Resolver Status")
|
|
|
|
me.digStatus.Show()
|
|
|
|
me.digStatus.Update()
|
2023-12-28 15:36:05 -06:00
|
|
|
} else {
|
2023-12-29 01:36:10 -06:00
|
|
|
me.digStatusButton.SetText("Resolver Status")
|
|
|
|
me.digStatus.Hide()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
me.hostnameStatusButton = me.mainStatus.NewButton("Show hostname DNS Status", func () {
|
|
|
|
if (me.hostnameStatus == nil) {
|
|
|
|
me.hostnameStatus = NewHostnameStatusWindow(myGui)
|
|
|
|
me.hostnameStatusButton.SetText("Hide " + me.hostname + " DNS Status")
|
|
|
|
me.hostnameStatus.Update()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if me.hostnameStatus.hidden {
|
|
|
|
me.hostnameStatusButton.SetText("Hide " + me.hostname + " DNS Status")
|
|
|
|
me.hostnameStatus.Show()
|
|
|
|
me.hostnameStatus.Update()
|
|
|
|
} else {
|
|
|
|
me.hostnameStatusButton.SetText("Show " + me.hostname + " DNS Status")
|
|
|
|
me.hostnameStatus.Hide()
|
2023-12-28 15:36:05 -06:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2023-12-20 03:13:43 -06:00
|
|
|
grid.Margin()
|
|
|
|
grid.Pad()
|
|
|
|
|
2023-12-16 09:02:59 -06:00
|
|
|
statusGrid(tab)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func statusGrid(n *gui.Node) {
|
|
|
|
problems := n.NewGroup("status")
|
|
|
|
|
|
|
|
gridP := problems.NewGrid("nuts", 2, 2)
|
|
|
|
|
|
|
|
gridP.NewLabel("DNS Status =")
|
2023-12-20 03:13:43 -06:00
|
|
|
me.DnsStatus = gridP.NewLabel("unknown")
|
2023-12-16 09:02:59 -06:00
|
|
|
|
2023-12-29 02:43:00 -06:00
|
|
|
me.statusIPv6 = gadgets.NewOneLiner(gridP, "IPv6 working")
|
2023-12-28 09:43:45 -06:00
|
|
|
me.statusIPv6.Set("known")
|
|
|
|
|
2023-12-16 09:02:59 -06:00
|
|
|
gridP.NewLabel("hostname =")
|
2023-12-29 01:36:10 -06:00
|
|
|
me.hostnameStatusOLD = gridP.NewLabel("invalid")
|
2023-12-16 09:02:59 -06:00
|
|
|
|
2023-12-20 03:13:43 -06:00
|
|
|
gridP.NewLabel("dns resolution")
|
|
|
|
me.DnsSpeed = gridP.NewLabel("unknown")
|
|
|
|
|
|
|
|
gridP.NewLabel("dns resolution speed")
|
|
|
|
me.DnsSpeedActual = gridP.NewLabel("unknown")
|
|
|
|
|
|
|
|
gridP.NewLabel("dns API provider =")
|
|
|
|
me.DnsAPI = gridP.NewLabel("unknown")
|
|
|
|
|
|
|
|
gridP.Margin()
|
|
|
|
gridP.Pad()
|
|
|
|
|
|
|
|
// TODO: these are notes for me things to figure out
|
|
|
|
ng := n.NewGroup("TODO:")
|
|
|
|
gridP = ng.NewGrid("nut2", 2, 2)
|
2023-12-16 09:02:59 -06:00
|
|
|
|
2023-12-20 03:13:43 -06:00
|
|
|
gridP.NewLabel("ping.wit.com =")
|
2023-12-16 09:02:59 -06:00
|
|
|
gridP.NewLabel("unknown")
|
2023-03-01 11:21:47 -06:00
|
|
|
|
2023-12-20 03:13:43 -06:00
|
|
|
gridP.NewLabel("ping6.wit.com =")
|
|
|
|
gridP.NewLabel("unknown")
|
|
|
|
|
|
|
|
problems.Margin()
|
|
|
|
problems.Pad()
|
|
|
|
gridP.Margin()
|
|
|
|
gridP.Pad()
|
2023-03-01 11:21:47 -06:00
|
|
|
}
|
2023-03-26 16:17:32 -05:00
|
|
|
|
2023-12-20 03:13:43 -06:00
|
|
|
// run everything because something has changed
|
2023-03-26 16:17:32 -05:00
|
|
|
func updateDNS() {
|
|
|
|
var aaaa []string
|
|
|
|
h := me.hostname
|
|
|
|
if (h == "") {
|
2023-12-20 03:13:43 -06:00
|
|
|
h = "test.wit.com"
|
2023-03-26 16:17:32 -05:00
|
|
|
}
|
2023-12-28 09:43:45 -06:00
|
|
|
|
|
|
|
me.digStatus.Update()
|
2023-12-29 01:36:10 -06:00
|
|
|
me.hostnameStatus.Update()
|
2023-12-28 09:43:45 -06:00
|
|
|
|
2023-12-20 03:13:43 -06:00
|
|
|
// log.Println("digAAAA()")
|
|
|
|
aaaa = digAAAA(h)
|
|
|
|
debug(LogNow, "digAAAA() =", aaaa)
|
2023-12-28 09:43:45 -06:00
|
|
|
|
2023-12-20 03:13:43 -06:00
|
|
|
// log.Println(SPEW, me)
|
2023-03-26 16:17:32 -05:00
|
|
|
if (aaaa == nil) {
|
2023-12-20 03:13:43 -06:00
|
|
|
debug(LogError, "There are no DNS AAAA records for hostname: ", h)
|
2023-12-28 09:43:45 -06:00
|
|
|
me.DnsAAAA.SetText("(none)")
|
|
|
|
if (cloudflare.CFdialog.TypeNode != nil) {
|
|
|
|
cloudflare.CFdialog.TypeNode.SetText("AAAA new")
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cloudflare.CFdialog.NameNode != nil) {
|
|
|
|
cloudflare.CFdialog.NameNode.SetText(me.hostname)
|
|
|
|
}
|
|
|
|
|
|
|
|
d := deleteAAA()
|
|
|
|
if (d != "") {
|
|
|
|
if (cloudflare.CFdialog.ValueNode != nil) {
|
|
|
|
cloudflare.CFdialog.ValueNode.SetText(d)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m := missingAAAA()
|
|
|
|
if (m != "") {
|
|
|
|
if (cloudflare.CFdialog.ValueNode != nil) {
|
|
|
|
cloudflare.CFdialog.ValueNode.SetText(m)
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
rr := &cloudflare.RRT{
|
|
|
|
Type: "AAAA",
|
|
|
|
Name: me.hostname,
|
|
|
|
Ttl: "Auto",
|
|
|
|
Proxied: false,
|
|
|
|
Content: m,
|
|
|
|
}
|
|
|
|
cloudflare.Update(rr)
|
|
|
|
*/
|
|
|
|
}
|
2023-03-26 16:17:32 -05:00
|
|
|
}
|
2023-12-28 09:43:45 -06:00
|
|
|
status := displayDNS() // update the GUI based on dig results
|
|
|
|
me.DnsStatus.SetText(status)
|
|
|
|
|
|
|
|
if me.digStatus.Ready() {
|
|
|
|
if me.digStatus.IPv6() {
|
|
|
|
me.statusIPv6.Set("IPv6 WORKING")
|
|
|
|
} else {
|
|
|
|
me.statusIPv6.Set("Need VPN")
|
|
|
|
}
|
2023-03-26 16:17:32 -05:00
|
|
|
}
|
|
|
|
|
2023-12-28 09:43:45 -06:00
|
|
|
|
|
|
|
// me.fix.Enable()
|
|
|
|
|
2023-03-26 16:17:32 -05:00
|
|
|
user, _ := user.Current()
|
2023-12-16 09:02:59 -06:00
|
|
|
log.Println("os.Getuid =", user.Username, os.Getuid())
|
2023-03-26 16:17:32 -05:00
|
|
|
if (me.uid != nil) {
|
|
|
|
me.uid.SetText(user.Username + " (" + strconv.Itoa(os.Getuid()) + ")")
|
|
|
|
}
|
2023-12-20 03:13:43 -06:00
|
|
|
|
|
|
|
// lookup the NS records for your domain
|
|
|
|
// if your host is test.wit.com, find the NS resource records for wit.com
|
|
|
|
lookupNS(me.domainname.S)
|
|
|
|
|
2023-12-16 09:02:59 -06:00
|
|
|
log.Println("updateDNS() END")
|
2023-03-26 16:17:32 -05:00
|
|
|
}
|
2023-12-20 03:13:43 -06:00
|
|
|
|
|
|
|
func suggestProcDebugging() {
|
|
|
|
if (me.fixProc != nil) {
|
|
|
|
// me.fixProc.Disable()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
me.fixProc = me.mainStatus.NewButton("Try debugging Slow DNS lookups", func () {
|
|
|
|
debug("You're DNS lookups are very slow")
|
|
|
|
me.dbOn.Set(true)
|
|
|
|
me.dbProc.Set(true)
|
|
|
|
|
|
|
|
DEBUGON = true
|
|
|
|
LogProc = true
|
|
|
|
processName := getProcessNameByPort(53)
|
|
|
|
log.Println("Process with port 53:", processName)
|
|
|
|
})
|
|
|
|
// me.fixProc.Disable()
|
|
|
|
}
|