blob: 94e0e8b9dbaa61cad47b7ae91db10aebc043de47 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
  | 
// This creates a simple hello world window
package main
import (
	"net"
	"time"
	"go.wit.com/gui"
	"go.wit.com/lib/gadgets"
	"go.wit.com/lib/gui/linuxstatus"
)
// It's probably a terrible idea to call this 'me'
var me Host
type Host struct {
	myGui *gui.Node // the 'gui' binary tree root node
	window *gadgets.BasicWindow // the main window
	debug  *gadgets.BasicWindow // the debug window
	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
	// WHEN THESE ARE ALL "WORKING", then everything is good
	hostnameStatus *gui.Node // a summary for the user of where things are
	DnsAPIstatus   *gui.Node // does your DNS API work?
	// APIprovider	string
	apiButton *gui.Node // the button you click for the API config page
	artificialSleep float64 `default:"0.7"` // artificial sleep on startup
	artificialS     string  `default:"abc"` // artificial sleep on startup
	ttl        *gadgets.Duration
	dnsTtl     *gadgets.Duration
	dnsSleep   time.Duration
	localSleep time.Duration
	changed bool // set to true if things changed
	ifmap map[int]*IFtype   // the current interfaces
	nsmap map[string]string // the NS records
	// DNS stuff
	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
	statusIPv6      *gadgets.OneLiner
	digStatusButton *gui.Node
	statusDNSbutton *gui.Node
	witcom          *gadgets.BasicWindow
	fixButton       *gui.Node
	fixWindow       *gadgets.BasicWindow
	showErrorsB     *gui.Node
	problems *errorBox
	// autofix  *gui.Node
}
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
}
  |