2023-02-18 23:37:11 -06:00
|
|
|
// This creates a simple hello world window
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
2023-12-20 03:13:43 -06:00
|
|
|
"time"
|
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-20 03:13:43 -06:00
|
|
|
"github.com/miekg/dns"
|
2023-02-18 23:37:11 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
// It's probably a terrible idea to call this 'me'
|
|
|
|
var me Host
|
|
|
|
|
|
|
|
type Host struct {
|
|
|
|
hostname string // mirrors
|
2023-12-20 03:13:43 -06:00
|
|
|
domainname *gui.Node // kernel.org
|
|
|
|
hostshort *gui.Node // hostname -s
|
2023-12-29 01:36:10 -06:00
|
|
|
hostnameStatusOLD *gui.Node // is the hostname configured correctly in the OS?
|
2023-03-09 14:21:34 -06:00
|
|
|
// fqdn string // mirrors.kernel.org
|
2023-12-16 12:59:18 -06:00
|
|
|
|
2023-12-21 17:56:56 -06:00
|
|
|
// dnsTTL int `default:"3"` // Recheck DNS is working every TTL (in seconds)
|
|
|
|
// dnsTTLsleep float64 // sleep between loops
|
2023-12-20 03:13:43 -06:00
|
|
|
artificialSleep float64 `default:"0.7"` // artificial sleep on startup
|
|
|
|
artificialS string `default:"abc"` // artificial sleep on startup
|
|
|
|
|
2023-12-29 02:43:00 -06:00
|
|
|
ttl *gadgets.Duration
|
|
|
|
dnsTtl *gadgets.Duration
|
2023-12-20 03:13:43 -06:00
|
|
|
dnsSleep time.Duration
|
|
|
|
localSleep time.Duration
|
2023-12-16 12:59:18 -06:00
|
|
|
|
2023-03-26 16:17:32 -05:00
|
|
|
changed bool // set to true if things changed
|
2023-03-01 11:21:47 -06:00
|
|
|
user string // name of the user
|
2023-12-16 12:59:18 -06:00
|
|
|
|
2023-02-18 23:37:11 -06:00
|
|
|
ipmap map[string]*IPtype // the current ip addresses
|
2023-03-01 11:21:47 -06:00
|
|
|
dnsmap map[string]*IPtype // the current dns addresses
|
2023-02-18 23:37:11 -06:00
|
|
|
ifmap map[int]*IFtype // the current interfaces
|
2023-12-20 03:13:43 -06:00
|
|
|
nsmap map[string]string // the NS records
|
|
|
|
|
|
|
|
// DNS A and AAAA results
|
|
|
|
ipv4s map[string]dns.RR
|
|
|
|
ipv6s map[string]dns.RR
|
2023-12-16 12:59:18 -06:00
|
|
|
|
2023-03-01 11:21:47 -06:00
|
|
|
window *gui.Node // the main window
|
|
|
|
tab *gui.Node // the main dns tab
|
|
|
|
notes *gui.Node // using this to put notes here
|
2023-12-20 03:13:43 -06:00
|
|
|
|
|
|
|
// local OS settings, network interfaces, etc
|
2023-03-09 14:21:34 -06:00
|
|
|
uid *gui.Node // user
|
|
|
|
fqdn *gui.Node // display the full hostname
|
|
|
|
IPv4 *gui.Node // show valid IPv4 addresses
|
|
|
|
IPv6 *gui.Node // show valid IPv6 addresses
|
2023-03-25 08:09:34 -05:00
|
|
|
Interfaces *gui.Node // Interfaces
|
2023-12-20 03:13:43 -06:00
|
|
|
LocalSpeedActual *gui.Node // the time it takes to check each network interface
|
|
|
|
|
|
|
|
// DNS stuff
|
|
|
|
NSrr *gui.Node // NS resource records for the domain name
|
|
|
|
DnsAPI *gui.Node // what DNS API to use?
|
2023-03-25 15:43:24 -05:00
|
|
|
DnsAAAA *gui.Node // the actual DNS AAAA results
|
2023-12-28 09:43:45 -06:00
|
|
|
workingIPv6 *gui.Node // currently working AAAA
|
2023-03-25 15:43:24 -05:00
|
|
|
DnsA *gui.Node // the actual DNS A results (ignore for status since mostly never happens?)
|
|
|
|
DnsStatus *gui.Node // the current state of DNS
|
2023-12-20 03:13:43 -06:00
|
|
|
DnsSpeed *gui.Node // 'FAST', 'OK', 'SLOW', etc
|
|
|
|
DnsSpeedActual *gui.Node // the last actual duration
|
|
|
|
DnsSpeedLast string // the last state 'FAST', 'OK', etc
|
|
|
|
|
2023-12-16 09:02:59 -06:00
|
|
|
fix *gui.Node // button for the user to click
|
2023-12-20 03:13:43 -06:00
|
|
|
fixProc *gui.Node // button for the user to click
|
|
|
|
|
|
|
|
mainStatus *gui.Node // group for the main display of stuff
|
|
|
|
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
|
2023-12-28 09:43:45 -06:00
|
|
|
|
|
|
|
digStatus *digStatus
|
2023-12-29 02:43:00 -06:00
|
|
|
statusIPv6 *gadgets.OneLiner
|
2023-12-28 15:36:05 -06:00
|
|
|
digStatusButton *gui.Node
|
2023-12-29 01:36:10 -06:00
|
|
|
|
|
|
|
hostnameStatus *hostnameStatus
|
|
|
|
hostnameStatusButton *gui.Node
|
2023-02-18 23:37:11 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
type IPtype struct {
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
type IFtype struct {
|
|
|
|
gone bool // used to track if the interface exists
|
|
|
|
name string // just a shortcut to the name. maybe this is dumb
|
|
|
|
// up bool // could be used to track ifup/ifdown
|
|
|
|
iface *net.Interface
|
|
|
|
}
|