2023-02-18 23:37:11 -06:00
|
|
|
// This creates a simple hello world window
|
|
|
|
package main
|
|
|
|
|
2024-01-21 00:15:20 -06:00
|
|
|
import (
|
2023-02-18 23:37:11 -06:00
|
|
|
"net"
|
2023-12-20 03:13:43 -06:00
|
|
|
"time"
|
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"
|
2024-01-21 00:15:20 -06:00
|
|
|
|
|
|
|
"go.wit.com/lib/gui/linuxstatus"
|
2023-02-18 23:37:11 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
// It's probably a terrible idea to call this 'me'
|
|
|
|
var me Host
|
|
|
|
|
|
|
|
type Host struct {
|
2024-01-21 00:15:20 -06:00
|
|
|
myGui *gui.Node // the 'gui' binary tree root node
|
2024-01-06 17:51:41 -06:00
|
|
|
|
2024-01-21 00:15:20 -06:00
|
|
|
window *gadgets.BasicWindow // the main window
|
|
|
|
debug *gadgets.BasicWindow // the debug window
|
2024-01-06 17:51:41 -06:00
|
|
|
|
2024-01-21 00:15:20 -06:00
|
|
|
statusDNS *hostnameStatus // keeps track of the hostname and it's status
|
|
|
|
statusOS *linuxstatus.LinuxStatus // what the Linux OS sees
|
|
|
|
digStatus *digStatus // window of the results of DNS lookups
|
2024-01-06 01:41:33 -06:00
|
|
|
|
2024-01-07 12:45:01 -06:00
|
|
|
// WHEN THESE ARE ALL "WORKING", then everything is good
|
2024-01-21 00:15:20 -06:00
|
|
|
hostnameStatus *gui.Node // a summary for the user of where things are
|
|
|
|
DnsAPIstatus *gui.Node // does your DNS API work?
|
2024-01-10 20:22:25 -06:00
|
|
|
// APIprovider string
|
2024-01-21 00:15:20 -06:00
|
|
|
apiButton *gui.Node // the button you click for the API config page
|
2023-12-16 12:59:18 -06:00
|
|
|
|
2024-01-21 00:15:20 -06:00
|
|
|
artificialSleep float64 `default:"0.7"` // artificial sleep on startup
|
|
|
|
artificialS string `default:"abc"` // artificial sleep on startup
|
2023-12-20 03:13:43 -06:00
|
|
|
|
2024-01-21 00:15:20 -06:00
|
|
|
ttl *gadgets.Duration
|
|
|
|
dnsTtl *gadgets.Duration
|
|
|
|
dnsSleep time.Duration
|
|
|
|
localSleep time.Duration
|
2023-12-16 12:59:18 -06:00
|
|
|
|
2024-01-21 00:15:20 -06:00
|
|
|
changed bool // set to true if things changed
|
2023-12-16 12:59:18 -06:00
|
|
|
|
2024-11-01 21:47:10 -05:00
|
|
|
ifmap map[int]*IFtype // the current interfaces
|
|
|
|
nsmap map[string]string // the NS records
|
2023-12-16 12:59:18 -06:00
|
|
|
|
2023-12-20 03:13:43 -06:00
|
|
|
// DNS stuff
|
2024-01-21 00:15:20 -06:00
|
|
|
DnsStatus *gui.Node // the current state of DNS
|
|
|
|
DnsSpeed *gui.Node // 'FAST', 'OK', 'SLOW', etc
|
|
|
|
DnsSpeedActual *gui.Node // the last actual duration
|
|
|
|
DnsSpeedLast string // the last state 'FAST', 'OK', etc
|
2023-12-20 03:13:43 -06:00
|
|
|
|
2024-01-21 00:15:20 -06:00
|
|
|
statusIPv6 *gadgets.OneLiner
|
2023-12-28 15:36:05 -06:00
|
|
|
digStatusButton *gui.Node
|
2024-01-07 07:09:59 -06:00
|
|
|
statusDNSbutton *gui.Node
|
2024-01-21 00:15:20 -06:00
|
|
|
witcom *gadgets.BasicWindow
|
|
|
|
fixButton *gui.Node
|
|
|
|
fixWindow *gadgets.BasicWindow
|
2024-02-01 08:49:16 -06:00
|
|
|
showErrorsB *gui.Node
|
2024-01-08 11:05:40 -06:00
|
|
|
|
2024-01-21 00:15:20 -06:00
|
|
|
problems *errorBox
|
2024-03-02 11:51:16 -06:00
|
|
|
// autofix *gui.Node
|
2023-02-18 23:37:11 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type IPtype struct {
|
2024-01-21 00:15:20 -06:00
|
|
|
gone bool // used to track if the ip exists
|
|
|
|
ipv6 bool // the future
|
|
|
|
ipv4 bool // the past
|
|
|
|
LinkLocal bool
|
|
|
|
iface *net.Interface
|
|
|
|
ip net.IP
|
|
|
|
ipnet *net.IPNet
|
2023-02-18 23:37:11 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type IFtype struct {
|
2024-01-21 00:15:20 -06:00
|
|
|
gone bool // used to track if the interface exists
|
|
|
|
name string // just a shortcut to the name. maybe this is dumb
|
2023-02-18 23:37:11 -06:00
|
|
|
// up bool // could be used to track ifup/ifdown
|
2024-01-21 00:15:20 -06:00
|
|
|
iface *net.Interface
|
2023-02-18 23:37:11 -06:00
|
|
|
}
|