From 5917838cbbac8c7d5d7aee89fdcb09990adb7b16 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Fri, 20 Jan 2012 12:24:20 +0100 Subject: [PATCH] gofmt --- client.go | 4 ++-- defaults.go | 8 ++++---- dnssec.go | 54 +++++++++++++++++++++++++------------------------- dnssec_test.go | 18 ++++++++--------- edns.go | 12 +++++------ msg.go | 4 ++-- nsec3.go | 12 +++++------ server.go | 4 ++-- tsig.go | 2 +- 9 files changed, 59 insertions(+), 59 deletions(-) diff --git a/client.go b/client.go index ccb8ec3d..a9c20c1b 100644 --- a/client.go +++ b/client.go @@ -128,8 +128,8 @@ type Client struct { Retry bool // retry with TCP QueryChan chan *Request // read DNS request from this channel ReplyChan chan *Exchange // write the reply (together with the DNS request) to this channel - ReadTimeout time.Duration // the net.Conn.SetReadTimeout value for new connections (ns) - WriteTimeout time.Duration // the net.Conn.SetWriteTimeout value for new connections (ns) + ReadTimeout time.Duration // the net.Conn.SetReadTimeout value for new connections (ns) + WriteTimeout time.Duration // the net.Conn.SetWriteTimeout value for new connections (ns) TsigSecret map[string]string // secret(s) for Tsig map[] Hijacked net.Conn // if set the calling code takes care of the connection // LocalAddr string // Local address to use diff --git a/defaults.go b/defaults.go index c1862c8b..84b12f87 100644 --- a/defaults.go +++ b/defaults.go @@ -54,10 +54,10 @@ func (dns *Msg) SetRcodeFormatError(request *Msg) { // SetUpdate makes the message a dynamic update packet. It // sets the ZONE section to: z, TypeSOA, classINET. func (dns *Msg) SetUpdate(z string) { - dns.MsgHdr.Id = Id() - dns.MsgHdr.Opcode = OpcodeUpdate - dns.Question = make([]Question, 1) - dns.Question[0] = Question{z, TypeSOA, ClassINET} + dns.MsgHdr.Id = Id() + dns.MsgHdr.Opcode = OpcodeUpdate + dns.Question = make([]Question, 1) + dns.Question[0] = Question{z, TypeSOA, ClassINET} } // SetIxfr creates dns msg suitable for requesting an ixfr. diff --git a/dnssec.go b/dnssec.go index bbb42206..728b27f4 100644 --- a/dnssec.go +++ b/dnssec.go @@ -411,7 +411,7 @@ func (k *RR_DNSKEY) pubKeyCurve() *ecdsa.PublicKey { case ECDSAP384SHA384: c = elliptic.P384() } - x, y := elliptic.Unmarshal(c,keybuf) + x, y := elliptic.Unmarshal(c, keybuf) pubkey := new(ecdsa.PublicKey) pubkey.X = x pubkey.Y = y @@ -484,32 +484,32 @@ func rawSignatureData(rrset RRset, s *RR_RRSIG) (buf []byte) { name := h.Name h.Name = strings.ToLower(h.Name) // 6.2. Canonical RR Form. (3) - domain rdata to lowercaser - /* - switch h.Rrtype { - case TypeNS: - r.(*RR_NS).Ns = strings.ToLower(r.(*RR_NS).Ns) - case TypeCNAME: - r.(*RR_CNAME).Cname = strings.ToLower(r.(*RR_CNAME).Cname) - case TypeSOA: - r.(*RR_SOA).Ns = strings.ToLower(r.(*RR_SOA).Ns) - r.(*RR_SOA).Mbox = strings.ToLower(r.(*RR_SOA).Mbox) - case TypeMB: - case TypeMG: - case TypeMR: - case TypePTR: - r.(*RR_PTR).Ptr = strings.ToLower(r.(*RR_PTR).Ptr) - case TypeMINFO: - case TypeMX: - r.(*RR_MX).Mx = strings.ToLower(r.(*RR_MX).Mx) - case TypeSIG: - case TypeRRSIG: - case TypeSRV: - case TypeNSEC: - r.(*RR_NSEC).NextDomain = strings.ToLower(r.(*RR_NSEC).NextDomain) - case TypeNSEC3: - r.(*RR_NSEC3).NextDomain = strings.ToLower(r.(*RR_NSEC3).NextDomain) - } - */ + /* + switch h.Rrtype { + case TypeNS: + r.(*RR_NS).Ns = strings.ToLower(r.(*RR_NS).Ns) + case TypeCNAME: + r.(*RR_CNAME).Cname = strings.ToLower(r.(*RR_CNAME).Cname) + case TypeSOA: + r.(*RR_SOA).Ns = strings.ToLower(r.(*RR_SOA).Ns) + r.(*RR_SOA).Mbox = strings.ToLower(r.(*RR_SOA).Mbox) + case TypeMB: + case TypeMG: + case TypeMR: + case TypePTR: + r.(*RR_PTR).Ptr = strings.ToLower(r.(*RR_PTR).Ptr) + case TypeMINFO: + case TypeMX: + r.(*RR_MX).Mx = strings.ToLower(r.(*RR_MX).Mx) + case TypeSIG: + case TypeRRSIG: + case TypeSRV: + case TypeNSEC: + r.(*RR_NSEC).NextDomain = strings.ToLower(r.(*RR_NSEC).NextDomain) + case TypeNSEC3: + r.(*RR_NSEC3).NextDomain = strings.ToLower(r.(*RR_NSEC3).NextDomain) + } + */ // 6.2. Canonical RR Form. (4) - wildcards // dont have to do anything diff --git a/dnssec_test.go b/dnssec_test.go index 7ac95090..41919a3a 100644 --- a/dnssec_test.go +++ b/dnssec_test.go @@ -237,15 +237,15 @@ func TestKeyRSA(t *testing.T) { sig.KeyTag = key.KeyTag() sig.SignerName = key.Hdr.Name - if err := sig.Sign(priv, []RR{soa}); err != nil { - t.Logf("Failed to sign") - t.Fail() - return - } - if err := sig.Verify(key, []RR{soa}); err != nil { - t.Logf("Failed to verify") - t.Fail() - } + if err := sig.Sign(priv, []RR{soa}); err != nil { + t.Logf("Failed to sign") + t.Fail() + return + } + if err := sig.Verify(key, []RR{soa}); err != nil { + t.Logf("Failed to verify") + t.Fail() + } } func TestKeyToDS(t *testing.T) { diff --git a/edns.go b/edns.go index 9516edd7..c16601ad 100644 --- a/edns.go +++ b/edns.go @@ -129,12 +129,12 @@ func (rr *RR_OPT) SetDo() { // Nsid returns the NSID as hex character string. func (rr *RR_OPT) Nsid() string { - for i := 0; i < len(rr.Option); i++ { - if rr.Option[i].Code == OptionCodeNSID { - return "NSID: " + rr.Option[i].Data - } - } - return "Not found" + for i := 0; i < len(rr.Option); i++ { + if rr.Option[i].Code == OptionCodeNSID { + return "NSID: " + rr.Option[i].Data + } + } + return "Not found" } // SetNsid sets the NSID from a hex character string. diff --git a/msg.go b/msg.go index 39c5e6ab..46597690 100644 --- a/msg.go +++ b/msg.go @@ -53,8 +53,8 @@ var ( ErrRRset error = &Error{Err: "invalid rrset"} ErrDenialNsec3 error = &Error{Err: "no NSEC3 records"} ErrDenialCe error = &Error{Err: "no matching closest encloser found"} - ErrDenialNc error = &Error{Err: "no covering NSEC3 found for next closer"} - ErrDenialSo error = &Error{Err: "no covering NSEC3 found for source of synthesis"} + ErrDenialNc error = &Error{Err: "no covering NSEC3 found for next closer"} + ErrDenialSo error = &Error{Err: "no covering NSEC3 found for source of synthesis"} ) // A manually-unpacked version of (id, bits). diff --git a/nsec3.go b/nsec3.go index 8bc5e695..f0ac6df2 100644 --- a/nsec3.go +++ b/nsec3.go @@ -129,31 +129,31 @@ func (m *Msg) Nsec3Verify(q Question) error { hashednc := HashName(nc, hash, iter, salt) if hashednc > firstlab && hashednc < nextdom { ncdenied = true - break + break } } if !ncdenied { return ErrDenialNc } - // Check if the source of synthesis is covered and thus denied + // Check if the source of synthesis is covered and thus denied for _, nsec := range nsec3 { firstlab := strings.ToUpper(SplitLabels(nsec.Header().Name)[0]) nextdom := strings.ToUpper(nsec.NextDomain) hashedso := HashName(so, hash, iter, salt) if hashedso > firstlab && hashedso < nextdom { sodenied = true - break + break } } if !sodenied { return ErrDenialSo } - println("NSEC3 proof succesfully proofed") - return nil + println("NSEC3 proof succesfully proofed") + return nil } /* - */ + */ return nil } diff --git a/server.go b/server.go index 384c2eb8..110bdbee 100644 --- a/server.go +++ b/server.go @@ -143,8 +143,8 @@ type Server struct { Net string // if "tcp" it will invoke a TCP listener, otherwise an UDP one Handler Handler // handler to invoke, dns.DefaultServeMux if nil UDPSize int // default buffer to use to read incoming UDP messages - ReadTimeout time.Duration // the net.Conn.SetReadTimeout value for new connections - WriteTimeout time.Duration // the net.Conn.SetWriteTimeout value for new connections + ReadTimeout time.Duration // the net.Conn.SetReadTimeout value for new connections + WriteTimeout time.Duration // the net.Conn.SetWriteTimeout value for new connections TsigSecret map[string]string // secret(s) for Tsig map[] } diff --git a/tsig.go b/tsig.go index 5d4fbb1c..4cd9e520 100644 --- a/tsig.go +++ b/tsig.go @@ -34,7 +34,7 @@ package dns import ( "crypto/hmac" - "crypto/md5" + "crypto/md5" "encoding/hex" "io" "strings"