summaryrefslogtreecommitdiff
path: root/dns.go
diff options
context:
space:
mode:
Diffstat (limited to 'dns.go')
-rw-r--r--dns.go65
1 files changed, 44 insertions, 21 deletions
diff --git a/dns.go b/dns.go
index 017ffce..14b6683 100644
--- a/dns.go
+++ b/dns.go
@@ -5,28 +5,10 @@
package main
import (
-// "os"
-// "os/exec"
- "log"
"net"
-// "git.wit.org/wit/gui"
-// "github.com/davecgh/go-spew/spew"
)
-type IPtype struct {
- // IP string
- IPv4 bool
- IPv6 bool
- LinkLocal bool
-}
-
-type Host struct {
- Name string
- domainname string
- hostname string
- fqdn string
- ips map[string]*IPtype
-}
+var dnsTTL int = 3600; // Recheck DNS is working every TTL (in seconds)
/*
Check a bunch of things. If they don't work right, then things are not correctly configured
@@ -43,9 +25,50 @@ func (h *Host) verifyETC() bool {
func (h *Host) updateIPs(host string) {
ips, err := net.LookupIP(host)
if err != nil {
- log.Fatal(err)
+ exit(err)
}
for _, ip := range ips {
- log.Println(host, ip)
+ 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.")
+ }
+}