diff --git a/ex/chaos/chaos.go b/ex/chaos/chaos.go index 4ef06afb..509d0a23 100644 --- a/ex/chaos/chaos.go +++ b/ex/chaos/chaos.go @@ -28,7 +28,7 @@ func main() { for _, a := range addr { m.Question[0] = dns.Question{"version.bind.", dns.TypeTXT, dns.ClassCHAOS} in, rtt, _, _ := c.ExchangeRtt(m, a) - if in != nil && len(in.Answer) > 0 { + if in != nil && len(in.Answer) > 0 { fmt.Printf("(time %.3d µs) %v\n", rtt/1e3, in.Answer[0]) } m.Question[0] = dns.Question{"hostname.bind.", dns.TypeTXT, dns.ClassCHAOS} @@ -43,10 +43,10 @@ func qhandler(w dns.RequestWriter, m *dns.Msg) { w.Dial() defer w.Close() if err := w.Send(m); err != nil { - w.Write(nil) - return - } - r, _ := w.Receive() + w.Write(nil) + return + } + r, _ := w.Receive() w.Write(r) } @@ -58,8 +58,8 @@ func addresses(conf *dns.ClientConfig, c *dns.Client, name string) []string { m4.SetQuestion(dns.Fqdn(os.Args[1]), dns.TypeA) m6 := new(dns.Msg) m6.SetQuestion(dns.Fqdn(os.Args[1]), dns.TypeAAAA) - c.Do(m4, conf.Servers[0] + ":" + conf.Port) - c.Do(m6, conf.Servers[0] + ":" + conf.Port) + c.Do(m4, conf.Servers[0]+":"+conf.Port) + c.Do(m6, conf.Servers[0]+":"+conf.Port) var ips []string i := 2 // two outstanding queries diff --git a/ex/fp/fp.go b/ex/fp/fp.go index 14327711..51e206e7 100644 --- a/ex/fp/fp.go +++ b/ex/fp/fp.go @@ -114,7 +114,7 @@ func (f *fingerprint) setString(str string) { for i, s := range strings.Split(str, ",") { switch i { case 0: // question section domain name - f.Query.Name = s + f.Query.Name = s case 1: // Qclass f.Query.Qclass = 0 if c, ok := dns.Str_class[s]; ok { @@ -208,12 +208,11 @@ func toFingerprint(m *dns.Msg) *fingerprint { f.Query.Qtype = m.Question[0].Qtype f.Query.Qclass = m.Question[0].Qclass } else { - // Default, nil values - f.Query.Name = "." - f.Query.Qtype = 0 - f.Query.Qclass = 0 - } - + // Default, nil values + f.Query.Name = "." + f.Query.Qtype = 0 + f.Query.Qclass = 0 + } f.Opcode = h.Opcode f.Rcode = h.Rcode @@ -357,8 +356,8 @@ func fingerPrintFromFile(f string) ([]*fingerprint, error) { if p { return nil, nil } - // Comments and empty lines are ignored - if l[0] != '#' && l[0] != '\n' { + // Comments and empty lines are ignored + if l[0] != '#' && l[0] != '\n' { prints = append(prints, newFingerprint(string(l))) } l, p, e = b.ReadLine() diff --git a/ex/funkensturm/funkensturm.go b/ex/funkensturm/funkensturm.go index d8ec34c6..7570586b 100644 --- a/ex/funkensturm/funkensturm.go +++ b/ex/funkensturm/funkensturm.go @@ -76,21 +76,21 @@ func main() { listen := flag.String("listen", "127.0.0.1:8053", "set the listener address") server := flag.String("server", "127.0.0.1:53", "remote server address(es), seperate with commas") verbose = flag.Bool("verbose", false, "Print packet as it flows through") -// cpuprofile := flag.String("cpuprofile", "", "write cpu profile to file") + // cpuprofile := flag.String("cpuprofile", "", "write cpu profile to file") flag.Usage = func() { flag.PrintDefaults() } flag.Parse() - /* - if *cpuprofile != "" { - f, err := os.Create(*cpuprofile) - if err != nil { - log.Fatal(err) + /* + if *cpuprofile != "" { + f, err := os.Create(*cpuprofile) + if err != nil { + log.Fatal(err) + } + pprof.StartCPUProfile(f) + defer pprof.StopCPUProfile() } - pprof.StartCPUProfile(f) - defer pprof.StopCPUProfile() - } - */ + */ clients := strings.Split(*server, ",") qr = make([]*FunkClient, len(clients)) diff --git a/ex/key2ds/key2ds.go b/ex/key2ds/key2ds.go index bffeb2d0..f08b43c3 100644 --- a/ex/key2ds/key2ds.go +++ b/ex/key2ds/key2ds.go @@ -18,10 +18,10 @@ func main() { } m := new(dns.Msg) m.SetQuestion(dns.Fqdn(os.Args[1]), dns.TypeDNSKEY) - m.SetEdns0(2048, true) + m.SetEdns0(2048, true) c := dns.NewClient() - r, _ := c.Exchange(m, conf.Servers[0] + ":" + conf.Port) + r, _ := c.Exchange(m, conf.Servers[0]+":"+conf.Port) if r == nil { fmt.Printf("*** no answer received for %s\n", os.Args[1]) os.Exit(1) @@ -34,10 +34,10 @@ func main() { for _, k := range r.Answer { if key, ok := k.(*dns.RR_DNSKEY); ok { key.Hdr.Ttl = 0 - for _, alg := range []int{dns.SHA1, dns.SHA256, dns.SHA384} { - ds := key.ToDS(alg) - fmt.Printf("%v; %d\n", ds, key.Flags) - } + for _, alg := range []int{dns.SHA1, dns.SHA256, dns.SHA384} { + ds := key.ToDS(alg) + fmt.Printf("%v; %d\n", ds, key.Flags) + } } } }