summaryrefslogtreecommitdiff
path: root/dns.go
blob: 4c329367a8850cf2854b71ef21924ebe0ce45b36 (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
// Various Linux/Unix'y things

// https://wiki.archlinux.org/title/Dynamic_DNS

package main

import 	(
	"net"
)

/*
	Check a bunch of things. If they don't work right, then things are not correctly configured
	They are things like:
		/etc/hosts
		hostname
		hostname -f
		domainname
*/
func (h *Host) verifyETC() bool {
	return true
}

func (h *Host) updateIPs(host string) {
    ips, err := net.LookupIP(host)
        if err != nil {
                exit(err)
        }
        for _, ip := range ips {
                log(host, ip)
        }
}

func (h *Host) setIPv4(ipv4s map[string]*IPtype) {
        for ip, t := range ipv4s {
		log("IPv4", ip, t)
        }
}

func (h *Host) checkDNS() {
	var ip4 bool = false
	var ip6 bool = false

	for s, t := range h.ipmap {
		i := t.iface
		ipt := "IPv4"
		if (t.ipv6) {
			ipt = "IPv6"
		}
		if (! t.IsReal()) {
			log(args.VerboseDNS, "\tIP is not Real", ipt, i.Index, i.Name, s)
			continue
		}

		log(args.VerboseDNS, "\tIP is Real    ", ipt, i.Index, i.Name, s)
		if (t.ipv6) {
			ip6 = true
		} else {
			ip4 = true
		}
	}

	if (ip4 == true) {
		log(args.VerboseDNS, "IPv4 should work. Wow. You actually have a real IPv4 address")
	} else {
		log(args.VerboseDNS, "IPv4 is broken. (be nice and setup ipv4-only.wit.com)")
	}
	if (ip6 == true) {
		log(args.VerboseDNS, "IPv6 should be working. Need to test it here.")
	} else {
		log(args.VerboseDNS, "IPv6 is broken. Need to fix it here.")
	}
}