2024-01-21 00:15:20 -06:00
|
|
|
/*
|
2023-12-29 01:36:10 -06:00
|
|
|
figures out if your hostname is valid
|
|
|
|
then checks if your DNS is setup correctly
|
|
|
|
*/
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-01-21 00:15:20 -06:00
|
|
|
"errors"
|
2023-12-29 01:36:10 -06:00
|
|
|
"fmt"
|
2024-01-21 00:15:20 -06:00
|
|
|
"os"
|
2023-12-29 01:36:10 -06:00
|
|
|
"reflect"
|
2024-01-07 07:09:59 -06:00
|
|
|
"sort"
|
2024-01-21 00:15:20 -06:00
|
|
|
"strings"
|
|
|
|
"time"
|
2023-12-29 01:36:10 -06:00
|
|
|
|
2024-01-21 00:15:20 -06:00
|
|
|
"go.wit.com/gui"
|
2024-01-31 13:34:02 -06:00
|
|
|
"go.wit.com/lib/gadgets"
|
2023-12-29 01:36:10 -06:00
|
|
|
"go.wit.com/log"
|
|
|
|
)
|
|
|
|
|
|
|
|
type hostnameStatus struct {
|
2024-01-21 00:15:20 -06:00
|
|
|
ready bool
|
|
|
|
hidden bool
|
|
|
|
changed bool
|
2023-12-29 01:36:10 -06:00
|
|
|
|
2024-01-21 00:15:20 -06:00
|
|
|
lastname string // used to watch for changes in the hostname
|
2023-12-29 01:36:10 -06:00
|
|
|
|
2024-01-21 00:15:20 -06:00
|
|
|
window *gadgets.BasicWindow
|
2023-12-29 01:36:10 -06:00
|
|
|
|
2023-12-29 21:14:36 -06:00
|
|
|
// Primary Directives
|
2024-01-21 00:15:20 -06:00
|
|
|
status *gadgets.OneLiner
|
|
|
|
summary *gadgets.OneLiner
|
|
|
|
statusIPv4 *gadgets.OneLiner
|
|
|
|
statusIPv6 *gadgets.OneLiner
|
2023-12-29 01:36:10 -06:00
|
|
|
|
2024-01-21 00:15:20 -06:00
|
|
|
hostname *gadgets.OneLiner
|
|
|
|
domainname *gadgets.OneLiner
|
2023-12-29 21:14:36 -06:00
|
|
|
|
2024-01-07 07:09:59 -06:00
|
|
|
// what the current IP addresses your network has given you
|
2024-01-21 00:15:20 -06:00
|
|
|
currentIPv4 *gadgets.OneLiner
|
|
|
|
currentIPv6 *gadgets.OneLiner
|
2023-12-29 21:14:36 -06:00
|
|
|
|
|
|
|
// what the DNS servers have
|
2024-01-21 00:15:20 -06:00
|
|
|
NSrr *gadgets.OneLiner
|
|
|
|
dnsA *gadgets.OneLiner
|
|
|
|
dnsAAAA *gadgets.OneLiner
|
|
|
|
dnsAPI *gadgets.OneLiner
|
|
|
|
APIprovider string
|
2023-12-29 21:14:36 -06:00
|
|
|
|
2024-01-21 00:15:20 -06:00
|
|
|
speed *gadgets.OneLiner
|
|
|
|
speedActual *gadgets.OneLiner
|
2023-12-29 21:14:36 -06:00
|
|
|
|
|
|
|
// Actions
|
2024-01-21 00:15:20 -06:00
|
|
|
// dnsValue *gui.Node
|
|
|
|
// dnsAction *gui.Node
|
2023-12-29 01:36:10 -06:00
|
|
|
}
|
|
|
|
|
2024-02-25 18:37:44 -06:00
|
|
|
func InitHostnameStatus() *hostnameStatus {
|
2023-12-29 01:36:10 -06:00
|
|
|
var hs *hostnameStatus
|
|
|
|
hs = new(hostnameStatus)
|
|
|
|
|
|
|
|
hs.ready = false
|
|
|
|
hs.hidden = true
|
2024-01-06 01:41:33 -06:00
|
|
|
// hs.hostname = me.hostname
|
2023-12-29 01:36:10 -06:00
|
|
|
|
2024-03-02 11:51:16 -06:00
|
|
|
hs.window = gadgets.RawBasicWindow("fix hostname here" + " Status")
|
2024-01-15 17:22:51 -06:00
|
|
|
hs.window.Make()
|
|
|
|
// hs.window.Draw()
|
|
|
|
// hs.window.Hide()
|
2024-01-05 00:42:15 -06:00
|
|
|
|
|
|
|
group := hs.window.Box().NewGroup("Summary")
|
2023-12-29 01:36:10 -06:00
|
|
|
grid := group.NewGrid("LookupStatus", 2, 2)
|
|
|
|
|
2024-01-31 12:36:52 -06:00
|
|
|
hs.status = gadgets.NewOneLiner(grid, "status").SetText("unknown")
|
|
|
|
hs.statusIPv4 = gadgets.NewOneLiner(grid, "IPv4").SetText("unknown")
|
|
|
|
hs.statusIPv6 = gadgets.NewOneLiner(grid, "IPv6").SetText("unknown")
|
2023-12-29 01:36:10 -06:00
|
|
|
|
|
|
|
group.Pad()
|
|
|
|
grid.Pad()
|
|
|
|
|
2024-01-05 00:42:15 -06:00
|
|
|
group = hs.window.Box().NewGroup("Details")
|
2023-12-29 01:36:10 -06:00
|
|
|
grid = group.NewGrid("LookupDetails", 2, 2)
|
|
|
|
|
2024-01-21 00:15:20 -06:00
|
|
|
hs.hostname = gadgets.NewOneLiner(grid, "hostname")
|
|
|
|
hs.domainname = gadgets.NewOneLiner(grid, "domain name")
|
|
|
|
hs.currentIPv4 = gadgets.NewOneLiner(grid, "Current IPv4")
|
|
|
|
hs.currentIPv6 = gadgets.NewOneLiner(grid, "Current IPv6")
|
2023-12-29 01:36:10 -06:00
|
|
|
|
2024-01-31 12:36:52 -06:00
|
|
|
hs.NSrr = gadgets.NewOneLiner(grid, "dns NS records").SetText("unknown")
|
|
|
|
hs.dnsAPI = gadgets.NewOneLiner(grid, "dns API provider").SetText("unknown")
|
|
|
|
hs.dnsA = gadgets.NewOneLiner(grid, "dns IPv4 resource records").SetText("unknown")
|
|
|
|
hs.dnsAAAA = gadgets.NewOneLiner(grid, "dns IPv6 resource records").SetText("unknown")
|
2023-12-29 21:14:36 -06:00
|
|
|
|
2024-01-31 12:36:52 -06:00
|
|
|
hs.speed = gadgets.NewOneLiner(grid, "speed").SetText("unknown")
|
|
|
|
hs.speedActual = gadgets.NewOneLiner(grid, "actual").SetText("unknown")
|
2023-12-29 01:36:10 -06:00
|
|
|
|
|
|
|
group.Pad()
|
|
|
|
grid.Pad()
|
|
|
|
|
|
|
|
hs.hidden = false
|
|
|
|
hs.ready = true
|
|
|
|
return hs
|
|
|
|
}
|
|
|
|
|
2023-12-29 21:14:36 -06:00
|
|
|
func (hs *hostnameStatus) Domain() string {
|
2024-01-21 00:15:20 -06:00
|
|
|
if !hs.Ready() {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
return hs.domainname.String()
|
2023-12-29 21:14:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func (hs *hostnameStatus) API() string {
|
2024-01-21 00:15:20 -06:00
|
|
|
if !hs.Ready() {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
return hs.dnsAPI.String()
|
2023-12-29 21:14:36 -06:00
|
|
|
}
|
|
|
|
|
2023-12-29 01:36:10 -06:00
|
|
|
func (hs *hostnameStatus) Update() {
|
2024-03-02 11:51:16 -06:00
|
|
|
// log.Info("hostnameStatus() Update() START")
|
2023-12-29 01:36:10 -06:00
|
|
|
if hs == nil {
|
2024-01-03 12:40:31 -06:00
|
|
|
log.Error(errors.New("hostnameStatus() Update() hs == nil"))
|
2023-12-29 01:36:10 -06:00
|
|
|
return
|
|
|
|
}
|
2024-01-21 00:15:20 -06:00
|
|
|
duration := timeFunction(func() {
|
2023-12-29 01:36:10 -06:00
|
|
|
hs.updateStatus()
|
|
|
|
})
|
|
|
|
s := fmt.Sprint(duration)
|
|
|
|
hs.set(hs.speedActual, s)
|
|
|
|
|
2024-01-21 00:15:20 -06:00
|
|
|
if duration > 500*time.Millisecond {
|
2023-12-29 01:36:10 -06:00
|
|
|
hs.set(hs.speed, "SLOW")
|
2024-01-21 00:15:20 -06:00
|
|
|
} else if duration > 100*time.Millisecond {
|
2023-12-29 01:36:10 -06:00
|
|
|
hs.set(hs.speed, "OK")
|
|
|
|
} else {
|
|
|
|
hs.set(hs.speed, "FAST")
|
|
|
|
}
|
2024-03-02 11:51:16 -06:00
|
|
|
// log.Info("hostnameStatus() Update() END")
|
2023-12-29 01:36:10 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// Returns true if the status is valid
|
|
|
|
func (hs *hostnameStatus) Ready() bool {
|
2024-01-21 00:15:20 -06:00
|
|
|
if hs == nil {
|
|
|
|
return false
|
|
|
|
}
|
2023-12-29 01:36:10 -06:00
|
|
|
return hs.ready
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns true if IPv4 is working
|
|
|
|
func (hs *hostnameStatus) IPv4() bool {
|
2024-01-21 00:15:20 -06:00
|
|
|
if !hs.Ready() {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if hs.statusIPv4.String() == "OK" {
|
2023-12-29 01:36:10 -06:00
|
|
|
return true
|
|
|
|
}
|
2024-01-21 00:15:20 -06:00
|
|
|
if hs.statusIPv4.String() == "GOOD" {
|
2023-12-29 01:36:10 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns true if IPv6 is working
|
|
|
|
func (hs *hostnameStatus) IPv6() bool {
|
2024-01-21 00:15:20 -06:00
|
|
|
if !hs.Ready() {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if hs.statusIPv6.String() == "GOOD" {
|
2023-12-29 01:36:10 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (hs *hostnameStatus) setIPv4(s string) {
|
2024-01-21 00:15:20 -06:00
|
|
|
if !hs.Ready() {
|
|
|
|
return
|
|
|
|
}
|
2024-01-31 12:36:52 -06:00
|
|
|
hs.statusIPv4.SetText(s)
|
2023-12-29 01:36:10 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func (hs *hostnameStatus) setIPv6(s string) {
|
2024-01-21 00:15:20 -06:00
|
|
|
if !hs.Ready() {
|
|
|
|
return
|
|
|
|
}
|
2024-01-31 12:36:52 -06:00
|
|
|
hs.statusIPv6.SetText(s)
|
2023-12-29 01:36:10 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func (hs *hostnameStatus) set(a any, s string) {
|
2024-01-21 00:15:20 -06:00
|
|
|
if !hs.Ready() {
|
|
|
|
return
|
|
|
|
}
|
2023-12-29 01:36:10 -06:00
|
|
|
if hs.hidden {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if a == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
var n *gui.Node
|
|
|
|
if reflect.TypeOf(a) == reflect.TypeOf(n) {
|
|
|
|
n = a.(*gui.Node)
|
|
|
|
n.SetText(s)
|
|
|
|
return
|
|
|
|
}
|
2023-12-29 02:10:25 -06:00
|
|
|
var ol *gadgets.OneLiner
|
2023-12-29 01:36:10 -06:00
|
|
|
if reflect.TypeOf(a) == reflect.TypeOf(ol) {
|
2023-12-29 02:10:25 -06:00
|
|
|
ol = a.(*gadgets.OneLiner)
|
2023-12-29 01:36:10 -06:00
|
|
|
if ol == nil {
|
2024-01-06 01:41:33 -06:00
|
|
|
// log.Println("ol = nil", reflect.TypeOf(a), "a =", a)
|
2023-12-29 01:36:10 -06:00
|
|
|
return
|
|
|
|
}
|
2024-01-06 01:41:33 -06:00
|
|
|
// log.Println("SETTING ol:", ol)
|
2024-01-31 12:36:52 -06:00
|
|
|
ol.SetText(s)
|
2023-12-29 01:36:10 -06:00
|
|
|
return
|
|
|
|
}
|
2024-01-03 12:40:31 -06:00
|
|
|
log.Warn("unknown type TypeOf(a) =", reflect.TypeOf(a), "a =", a)
|
2023-12-29 01:36:10 -06:00
|
|
|
os.Exit(0)
|
|
|
|
}
|
|
|
|
|
2024-01-06 01:41:33 -06:00
|
|
|
// returns true if AAAA record already exists in DNS
|
|
|
|
func (hs *hostnameStatus) existsAAAA(s string) bool {
|
|
|
|
log.Log(NOW, "existsAAAA() try to see if AAAA is already set", s)
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2024-01-06 19:58:58 -06:00
|
|
|
func (hs *hostnameStatus) GetIPv6() []string {
|
2024-01-21 00:15:20 -06:00
|
|
|
if !hs.Ready() {
|
|
|
|
return nil
|
|
|
|
}
|
2024-03-02 11:51:16 -06:00
|
|
|
// clean out any blank lines
|
|
|
|
// todo: fix this whole hacky thing
|
|
|
|
tmp := hs.dnsAAAA.String()
|
|
|
|
tmp = strings.TrimSpace(tmp)
|
|
|
|
return strings.Split(tmp, "\n")
|
2024-01-06 19:00:51 -06:00
|
|
|
}
|
|
|
|
|
2024-11-01 21:47:10 -05:00
|
|
|
func (hs *hostnameStatus) GetIPv4() []string {
|
|
|
|
if !hs.Ready() {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
// clean out any blank lines
|
|
|
|
// todo: fix this whole hacky thing
|
|
|
|
tmp := hs.dnsA.String()
|
|
|
|
tmp = strings.TrimSpace(tmp)
|
|
|
|
return strings.Split(tmp, "\n")
|
|
|
|
}
|
|
|
|
|
2023-12-29 01:36:10 -06:00
|
|
|
func (hs *hostnameStatus) updateStatus() {
|
2024-01-21 00:15:20 -06:00
|
|
|
if !hs.Ready() {
|
|
|
|
return
|
|
|
|
}
|
2023-12-29 01:36:10 -06:00
|
|
|
var s string
|
|
|
|
var vals []string
|
2024-01-06 01:41:33 -06:00
|
|
|
log.Log(STATUS, "updateStatus() START")
|
2023-12-29 01:36:10 -06:00
|
|
|
|
2024-01-07 07:09:59 -06:00
|
|
|
// copy the OS status over
|
2024-01-21 00:15:20 -06:00
|
|
|
lasthostname := hs.hostname.String()
|
2024-01-07 07:09:59 -06:00
|
|
|
hostname := me.statusOS.GetHostname()
|
|
|
|
|
|
|
|
// hostname changed or was setup for the first time. Set the window title, etc
|
|
|
|
if lasthostname != hostname {
|
|
|
|
me.changed = true
|
2024-01-31 12:36:52 -06:00
|
|
|
hs.hostname.SetText(hostname)
|
2024-01-21 00:15:20 -06:00
|
|
|
hs.window.SetLabel(hostname + " Status")
|
|
|
|
me.statusDNSbutton.SetLabel(hostname + " status")
|
2024-01-07 07:09:59 -06:00
|
|
|
}
|
2024-01-31 12:36:52 -06:00
|
|
|
hs.domainname.SetText(me.statusOS.GetDomainName())
|
2023-12-29 21:14:36 -06:00
|
|
|
|
2024-01-07 15:05:36 -06:00
|
|
|
var tmp []string
|
|
|
|
tmp = me.statusOS.GetIPv4()
|
2024-01-07 07:09:59 -06:00
|
|
|
sort.Strings(tmp)
|
2024-01-07 15:05:36 -06:00
|
|
|
s = strings.Join(tmp, "\n")
|
2024-01-21 00:15:20 -06:00
|
|
|
if s != hs.currentIPv4.String() {
|
2024-01-07 15:05:36 -06:00
|
|
|
log.Log(CHANGE, "DNS IPv4 Addresses changed", tmp)
|
2024-01-31 12:36:52 -06:00
|
|
|
hs.currentIPv4.SetText(s)
|
2024-01-07 15:05:36 -06:00
|
|
|
hs.changed = true
|
|
|
|
}
|
2024-01-07 07:09:59 -06:00
|
|
|
|
|
|
|
tmp = me.statusOS.GetIPv6()
|
|
|
|
sort.Strings(tmp)
|
2024-01-07 15:05:36 -06:00
|
|
|
s = strings.Join(tmp, "\n")
|
2024-01-21 00:15:20 -06:00
|
|
|
if s != hs.currentIPv6.String() {
|
2024-01-07 15:05:36 -06:00
|
|
|
log.Log(CHANGE, "DNS IPv6 Addresses changed", tmp)
|
2024-01-31 12:36:52 -06:00
|
|
|
hs.currentIPv6.SetText(s)
|
2024-01-07 15:05:36 -06:00
|
|
|
hs.changed = true
|
|
|
|
}
|
2024-01-07 07:09:59 -06:00
|
|
|
|
2024-01-06 16:59:33 -06:00
|
|
|
if me.statusOS.ValidHostname() {
|
|
|
|
vals = lookupDoH(me.statusOS.GetHostname(), "AAAA")
|
2024-01-06 01:41:33 -06:00
|
|
|
|
2024-01-06 16:59:33 -06:00
|
|
|
log.Log(STATUS, "DNS IPv6 Addresses for ", me.statusOS.GetHostname(), "=", vals)
|
2024-01-31 12:36:52 -06:00
|
|
|
hs.dnsAAAA.SetText(strings.Join(vals, "\n"))
|
2024-01-06 01:41:33 -06:00
|
|
|
|
2024-01-06 16:59:33 -06:00
|
|
|
vals = lookupDoH(me.statusOS.GetHostname(), "A")
|
|
|
|
log.Log(STATUS, "IPv4 Addresses for ", me.statusOS.GetHostname(), "=", vals)
|
2024-01-06 01:41:33 -06:00
|
|
|
s = strings.Join(vals, "\n")
|
2024-01-21 00:15:20 -06:00
|
|
|
if s == "" {
|
2024-01-06 01:41:33 -06:00
|
|
|
s = "(none)"
|
|
|
|
hs.setIPv4("NEEDS CNAME")
|
2023-12-29 01:36:10 -06:00
|
|
|
}
|
2024-01-06 01:41:33 -06:00
|
|
|
hs.set(hs.dnsA, s)
|
2023-12-29 01:36:10 -06:00
|
|
|
|
2024-01-06 16:59:33 -06:00
|
|
|
vals = lookupDoH(me.statusOS.GetHostname(), "CNAME")
|
2024-01-06 01:41:33 -06:00
|
|
|
s = strings.Join(vals, "\n")
|
2024-01-21 00:15:20 -06:00
|
|
|
if s != "" {
|
|
|
|
hs.set(hs.dnsA, "CNAME "+s)
|
2024-01-06 01:41:33 -06:00
|
|
|
hs.setIPv4("GOOD")
|
|
|
|
}
|
2024-01-07 15:05:36 -06:00
|
|
|
if hs.changed {
|
|
|
|
log.Log(CHANGE, "stuff changed. trying fixIPv6dns()")
|
|
|
|
fixIPv6dns()
|
|
|
|
hs.changed = false
|
|
|
|
}
|
2023-12-29 01:36:10 -06:00
|
|
|
}
|
|
|
|
|
2024-01-06 01:41:33 -06:00
|
|
|
if hs.IPv4() && hs.IPv6() {
|
2024-01-31 12:36:52 -06:00
|
|
|
hs.status.SetText("GOOD")
|
2023-12-29 01:36:10 -06:00
|
|
|
} else {
|
2024-01-31 12:36:52 -06:00
|
|
|
hs.status.SetText("BROKEN")
|
2023-12-29 01:36:10 -06:00
|
|
|
}
|
2024-01-21 00:15:20 -06:00
|
|
|
|
|
|
|
last := hs.statusIPv6.String()
|
2024-03-02 11:51:16 -06:00
|
|
|
if ok, err := hs.verifyIPv6(); ok {
|
2024-01-08 11:05:40 -06:00
|
|
|
if last != "WORKING" {
|
|
|
|
log.Log(CHANGE, "Your DNS IPv6 has started working.", me.statusOS.GetHostname(), "should now work")
|
|
|
|
hs.changed = true
|
2024-01-31 12:36:52 -06:00
|
|
|
hs.statusIPv6.SetText("WORKING")
|
2024-01-08 11:05:40 -06:00
|
|
|
me.DnsStatus.SetText("WORKING")
|
|
|
|
}
|
2024-01-07 15:27:44 -06:00
|
|
|
} else {
|
2024-01-08 11:05:40 -06:00
|
|
|
if last != "BROKEN" {
|
2024-03-02 11:51:16 -06:00
|
|
|
log.Log(CHANGE, "Your DNS entries for IPv6 have BROKEN", ok, err)
|
2024-01-08 11:05:40 -06:00
|
|
|
hs.changed = true
|
2024-01-31 12:36:52 -06:00
|
|
|
hs.statusIPv6.SetText("BROKEN")
|
2024-01-08 11:05:40 -06:00
|
|
|
me.DnsStatus.SetText("BROKEN")
|
|
|
|
}
|
2024-01-07 15:27:44 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-02 11:51:16 -06:00
|
|
|
var ErrorNoIPv6 error = errors.New("OS has no IPv6")
|
|
|
|
var ErrorDeleteIPv6 error = errors.New("IPv6 Delete")
|
|
|
|
var ErrorCreateIPv6 error = errors.New("IPv6 Create")
|
|
|
|
|
|
|
|
func (hs *hostnameStatus) verifyIPv6() (bool, error) {
|
2024-01-07 15:27:44 -06:00
|
|
|
var working bool = true
|
2024-03-02 11:51:16 -06:00
|
|
|
var err error = nil
|
2024-01-07 15:27:44 -06:00
|
|
|
osAAAA := make(map[string]string)
|
|
|
|
dnsAAAA := make(map[string]string)
|
|
|
|
|
|
|
|
log.Log(INFO, "What are the AAAA resource records in the OS?")
|
|
|
|
tmp := me.statusOS.GetIPv6()
|
|
|
|
if len(tmp) == 0 {
|
|
|
|
// you don't have any IPv6 addresses in your OS right now
|
2024-03-02 11:51:16 -06:00
|
|
|
return false, ErrorNoIPv6
|
2024-01-07 15:27:44 -06:00
|
|
|
}
|
|
|
|
for _, aaaa := range me.statusOS.GetIPv6() {
|
|
|
|
log.Log(INFO, "FOUND OS AAAA ip", aaaa)
|
|
|
|
osAAAA[aaaa] = "os"
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Log(INFO, "What are the AAAA resource records in DNS?")
|
|
|
|
for _, aaaa := range me.statusDNS.GetIPv6() {
|
2024-11-01 21:47:10 -05:00
|
|
|
// log.Log(INFO, "FOUND DNS AAAA ip", aaaa)
|
2024-01-07 15:27:44 -06:00
|
|
|
dnsAAAA[aaaa] = "dns"
|
|
|
|
}
|
|
|
|
|
|
|
|
for aaaa, _ := range dnsAAAA {
|
|
|
|
if osAAAA[aaaa] == "os" {
|
|
|
|
log.Log(INFO, "DNS AAAA is in OS", aaaa)
|
|
|
|
} else {
|
|
|
|
working = false
|
|
|
|
log.Log(INFO, "DNS AAAA is not in OS", aaaa)
|
2024-01-08 11:05:40 -06:00
|
|
|
addToFixWindow("DELETE", aaaa)
|
2024-03-02 11:51:16 -06:00
|
|
|
err = ErrorDeleteIPv6
|
2024-01-07 15:27:44 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for aaaa, _ := range osAAAA {
|
|
|
|
if dnsAAAA[aaaa] == "dns" {
|
|
|
|
log.Log(INFO, "OS AAAA is in DNS", aaaa)
|
|
|
|
} else {
|
|
|
|
working = false
|
|
|
|
log.Log(INFO, "OS AAAA is not in DNS", aaaa)
|
2024-01-08 11:05:40 -06:00
|
|
|
addToFixWindow("CREATE", aaaa)
|
2024-03-02 11:51:16 -06:00
|
|
|
err = ErrorCreateIPv6
|
2024-01-07 15:27:44 -06:00
|
|
|
}
|
|
|
|
}
|
2023-12-29 01:36:10 -06:00
|
|
|
|
2024-03-02 11:51:16 -06:00
|
|
|
return working, err
|
2023-12-29 01:36:10 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func (hs *hostnameStatus) Show() {
|
2024-01-06 01:41:33 -06:00
|
|
|
log.Log(STATUS, "hostnameStatus.Show() window")
|
2023-12-29 01:36:10 -06:00
|
|
|
if hs.hidden {
|
|
|
|
hs.window.Show()
|
|
|
|
}
|
|
|
|
hs.hidden = false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (hs *hostnameStatus) Hide() {
|
2024-01-06 01:41:33 -06:00
|
|
|
log.Log(STATUS, "hostnameStatus.Hide() window")
|
2024-01-21 00:15:20 -06:00
|
|
|
if !hs.hidden {
|
2023-12-29 01:36:10 -06:00
|
|
|
hs.window.Hide()
|
|
|
|
}
|
|
|
|
hs.hidden = true
|
|
|
|
}
|
2024-01-07 12:45:01 -06:00
|
|
|
|
|
|
|
func (hs *hostnameStatus) GetDNSapi() string {
|
2024-01-10 20:22:25 -06:00
|
|
|
return hs.APIprovider
|
|
|
|
}
|
|
|
|
|
|
|
|
func (hs *hostnameStatus) SetDNSapi(api string) {
|
|
|
|
if api == hs.APIprovider {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
hs.APIprovider = api
|
2024-01-31 12:36:52 -06:00
|
|
|
hs.dnsAPI.SetText(api)
|
2024-01-10 20:22:25 -06:00
|
|
|
hs.changed = true
|
2024-01-07 12:45:01 -06:00
|
|
|
}
|