From 131f6962d19cdb1d0d4800e7802e5c7ce1b787db Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Fri, 9 Dec 2011 21:45:57 +0100 Subject: [PATCH] gofmt --- clientconfig.go | 4 ++-- dnssec.go | 14 +++++++------- dnssec_test.go | 2 +- dyn_test.go | 4 ++-- edns.go | 2 +- keygen.go | 10 +++++----- msg.go | 4 ++-- nsec3.go | 2 +- parse_test.go | 2 +- types.go | 26 +++++++++++++------------- update.go | 2 +- zparse.go | 16 ++++++++-------- 12 files changed, 44 insertions(+), 44 deletions(-) diff --git a/clientconfig.go b/clientconfig.go index cbc14ef9..2321e688 100644 --- a/clientconfig.go +++ b/clientconfig.go @@ -8,11 +8,11 @@ package dns import ( - "os" "bufio" + "net" + "os" "strconv" "strings" - "net" ) // Wraps the contents of the /etc/resolv.conf. diff --git a/dnssec.go b/dnssec.go index 453a82b2..4d15e313 100644 --- a/dnssec.go +++ b/dnssec.go @@ -33,8 +33,8 @@ const ( ECCGOST = 12 ECDSAP256SHA256 = 13 ECDSAP384SHA384 = 14 - PRIVATEDNS = 253 // Private (experimental keys) - PRIVATEOID = 254 + PRIVATEDNS = 253 // Private (experimental keys) + PRIVATEOID = 254 ) // DNSSEC hashing algorithm codes. @@ -307,9 +307,9 @@ func (s *RR_RRSIG) Verify(k *RR_DNSKEY, rrset RRset) error { signeddata = append(signeddata, wire...) sigbuf := s.sigBuf() // Get the binary signature data - if s.Algorithm == PRIVATEDNS { - // remove the domain name and assume its our - } + if s.Algorithm == PRIVATEDNS { + // remove the domain name and assume its our + } switch s.Algorithm { case RSASHA1, RSASHA1NSEC3SHA1, RSASHA256, RSASHA512, RSAMD5: @@ -515,6 +515,6 @@ var alg_str = map[uint8]string{ ECCGOST: "ECC-GOST", ECDSAP256SHA256: "ECDSAP256SHA256", ECDSAP384SHA384: "ECDSAP384SHA384", - PRIVATEDNS: "PRIVATEDNS", - PRIVATEOID: "PRIVATEOID", + PRIVATEDNS: "PRIVATEDNS", + PRIVATEOID: "PRIVATEOID", } diff --git a/dnssec_test.go b/dnssec_test.go index 5f6abfae..74566a34 100644 --- a/dnssec_test.go +++ b/dnssec_test.go @@ -1,8 +1,8 @@ package dns import ( - "testing" "strings" + "testing" ) func TestSecure(t *testing.T) { diff --git a/dyn_test.go b/dyn_test.go index d634ba89..54e29eb1 100644 --- a/dyn_test.go +++ b/dyn_test.go @@ -47,12 +47,12 @@ func TestUpdateDelete(t *testing.T) { if e != nil { t.Log("Failed: " + e.Error()) t.Fail() - return + return } if r != nil && r.Rcode != RcodeSuccess { t.Log("Failed: " + r.String()) t.Fail() - return + return } t.Log(r.String()) } diff --git a/edns.go b/edns.go index 2d61fffc..f003167d 100644 --- a/edns.go +++ b/edns.go @@ -1,8 +1,8 @@ package dns import ( - "strconv" "encoding/hex" + "strconv" ) // EDNS0 Option codes. diff --git a/keygen.go b/keygen.go index 2bf70948..e6b69c69 100644 --- a/keygen.go +++ b/keygen.go @@ -1,13 +1,13 @@ package dns import ( - "io" - "math/big" - "strconv" - "crypto/rsa" "crypto/ecdsa" "crypto/elliptic" "crypto/rand" + "crypto/rsa" + "io" + "math/big" + "strconv" ) // Empty interface that is used as a wrapper around all possible @@ -22,7 +22,7 @@ type PrivateKey interface{} // bits should be set to the size of the algorithm. func (r *RR_DNSKEY) Generate(bits int) (PrivateKey, error) { switch r.Algorithm { - case RSAMD5, RSASHA1, RSASHA256, RSASHA1NSEC3SHA1: + case RSAMD5, RSASHA1, RSASHA256, RSASHA1NSEC3SHA1: if bits < 512 || bits > 4096 { return nil, ErrKeySize } diff --git a/msg.go b/msg.go index d6dc1b0b..a2c06276 100644 --- a/msg.go +++ b/msg.go @@ -347,13 +347,13 @@ func packStructValue(val reflect.Value, msg []byte, off int) (off1 int, ok bool) msg[off+1] = byte(fv.Index(13).Uint()) msg[off+2] = byte(fv.Index(14).Uint()) msg[off+3] = byte(fv.Index(15).Uint()) - off += net.IPv4len + off += net.IPv4len case net.IPv4len: msg[off] = byte(fv.Index(0).Uint()) msg[off+1] = byte(fv.Index(1).Uint()) msg[off+2] = byte(fv.Index(2).Uint()) msg[off+3] = byte(fv.Index(3).Uint()) - off += net.IPv4len + off += net.IPv4len default: } case "AAAA": diff --git a/nsec3.go b/nsec3.go index 878c89e6..eb7a7c21 100644 --- a/nsec3.go +++ b/nsec3.go @@ -1,9 +1,9 @@ package dns import ( + "crypto/sha1" "hash" "strings" - "crypto/sha1" ) type saltWireFmt struct { diff --git a/parse_test.go b/parse_test.go index b4107365..7bf1abec 100644 --- a/parse_test.go +++ b/parse_test.go @@ -4,9 +4,9 @@ import ( // "os" // "time" // "bufio" + "crypto/rsa" "strings" "testing" - "crypto/rsa" ) func TestSign(t *testing.T) { diff --git a/types.go b/types.go index 1d2ff66f..891fbb4f 100644 --- a/types.go +++ b/types.go @@ -684,10 +684,10 @@ func (rr *RR_NSEC3PARAM) String() string { // saltString converts a NSECX salt to uppercase and // returns "-" when it is empty func saltString(s string) string { - if len(s) == 0 { - return "-" - } - return strings.ToUpper(s) + if len(s) == 0 { + return "-" + } + return strings.ToUpper(s) } // See RFC 4408. @@ -807,26 +807,26 @@ func (rr *RR_TSIG) String() string { // Translate the RRSIG's incep. and expir. time to the correct date. // Taking into account serial arithmetic (RFC 1982) func timeToDate(t uint32) string { - //utc := time.Now().Unix() + //utc := time.Now().Unix() //mod := (int64(t) - utc) / Year68 // If needed assume wrap around(s) - return "" - /* TODO: new time api + return "" + /* TODO: new time api ti := time.Unix(int64(t),0).Unix() + (mod * Year68) // abs()? TODO return ti.Format("20060102150405") - */ + */ } // Translate the TSIG time signed into a date. There is no // need for RFC1982 calculations as this date is 48 bits func tsigTimeToDate(t uint64) string { // only use the lower 48 bits, TODO(mg), check for 48 bit size - return "" - /* - ti := time.Unix(int64(t), 0).Unix() - return ti.Format("20060102150405") - */ + return "" + /* + ti := time.Unix(int64(t), 0).Unix() + return ti.Format("20060102150405") + */ } // Map of constructors for each RR wire type. diff --git a/update.go b/update.go index 83a31196..76192f62 100644 --- a/update.go +++ b/update.go @@ -53,7 +53,7 @@ func (u *Msg) Additional() []RR { // NewUpdate creates a new DNS update packet, which is a normal DNS message. func NewUpdate(zone string, class uint16) *Msg { u := new(Msg) - u.MsgHdr.Response = false + u.MsgHdr.Response = false u.MsgHdr.Opcode = OpcodeUpdate u.Question = make([]Question, 1) u.Question[0] = Question{zone, TypeSOA, class} diff --git a/zparse.go b/zparse.go index c7a2c682..adb14376 100644 --- a/zparse.go +++ b/zparse.go @@ -7,9 +7,9 @@ package dns import ( "io" // "net" - "time" - "strings" "strconv" + "strings" + "time" ) const _IOBUF = MaxMsgSize @@ -63,12 +63,12 @@ func dateToTime(s string) (uint32, error) { if e != nil { return 0, e } - return 0, nil - /* - mod := t.Seconds() / Year68 - ti := uint32(t.Seconds() - (mod * Year68)) - return ti, nil - */ + return 0, nil + /* + mod := t.Seconds() / Year68 + ti := uint32(t.Seconds() - (mod * Year68)) + return ti, nil + */ } // Return the rdata fields as a string slice.