From 73b6d37885e994841f2c5e8e2dd87f73c90bbbb7 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Fri, 17 Aug 2012 08:29:45 +0200 Subject: [PATCH] cleanup api, dont export Year68 --- dns.go | 2 +- dnssec.go | 8 ++++---- msg.go | 2 +- types.go | 8 ++++---- zone.go | 2 +- zscan_rr.go | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dns.go b/dns.go index edc78a19..12e91aec 100644 --- a/dns.go +++ b/dns.go @@ -68,7 +68,7 @@ import ( ) const ( - Year68 = 1 << 31 // For RFC1982 (Serial Arithmetic) calculations in 32 bits. + year68 = 1 << 31 // For RFC1982 (Serial Arithmetic) calculations in 32 bits. DefaultMsgSize = 4096 // Standard default for larger than 512 packets. UDPMsgSize = 512 // Default buffer size for servers receiving UDP packets. MaxMsgSize = 65536 // Largest possible DNS packet. diff --git a/dnssec.go b/dnssec.go index c49ac7f2..c5f11a82 100644 --- a/dnssec.go +++ b/dnssec.go @@ -424,10 +424,10 @@ func (s *RR_RRSIG) Verify(k *RR_DNSKEY, rrset []RR) error { // if a signature period is valid. func (s *RR_RRSIG) ValidityPeriod() bool { utc := time.Now().UTC().Unix() - modi := (int64(s.Inception) - utc) / Year68 - mode := (int64(s.Expiration) - utc) / Year68 - ti := int64(s.Inception) + (modi * Year68) - te := int64(s.Expiration) + (mode * Year68) + modi := (int64(s.Inception) - utc) / year68 + mode := (int64(s.Expiration) - utc) / year68 + ti := int64(s.Inception) + (modi * year68) + te := int64(s.Expiration) + (mode * year68) return ti <= utc && utc <= te } diff --git a/msg.go b/msg.go index de3caaea..bd0f69d9 100644 --- a/msg.go +++ b/msg.go @@ -104,7 +104,7 @@ var Rr_str = map[uint16]string{ TypeWKS: "WKS", TypeNS: "NS", TypePTR: "PTR", - TypeRT: "RT", + TypeRT: "RT", TypeSOA: "SOA", TypeTXT: "TXT", TypeSRV: "SRV", diff --git a/types.go b/types.go index 25bb4d8f..b53f9e54 100644 --- a/types.go +++ b/types.go @@ -1374,11 +1374,11 @@ func (rr *RR_WKS) Copy() RR { // string representation used when printing the record. // It takes serial arithmetic (RFC 1982) into account. func TimeToDate(t uint32) string { - mod := ((int64(t) - time.Now().Unix()) / Year68) - 1 + mod := ((int64(t) - time.Now().Unix()) / year68) - 1 if mod < 0 { mod = 0 } - ti := time.Unix(int64(t)-(mod*Year68), 0).UTC() + ti := time.Unix(int64(t)-(mod*year68), 0).UTC() return ti.Format("20060102150405") } @@ -1390,11 +1390,11 @@ func DateToTime(s string) (uint32, error) { if e != nil { return 0, e } - mod := (t.Unix() / Year68) - 1 + mod := (t.Unix() / year68) - 1 if mod < 0 { mod = 0 } - return uint32(t.Unix() - (mod * Year68)), nil + return uint32(t.Unix() - (mod * year68)), nil } // saltString converts a NSECX salt to uppercase and diff --git a/zone.go b/zone.go index b9975f74..e5812883 100644 --- a/zone.go +++ b/zone.go @@ -10,7 +10,7 @@ import ( // Zone represents a DNS zone. type Zone struct { Origin string // Origin of the zone - Wildcard int // Whenever we see a wildcard name, this is incremented + Wildcard int // Whenever we see a wildcard name, this is incremented *radix.Radix // Zone data } diff --git a/zscan_rr.go b/zscan_rr.go index 7cf71159..4ecb124f 100644 --- a/zscan_rr.go +++ b/zscan_rr.go @@ -373,7 +373,7 @@ func setRT(h RR_Header, c chan lex, o, f string) (RR, *ParseError) { return nil, &ParseError{f, "bad RT Host", l} } if rr.Host[ld-1] != '.' { - rr.Host= appendOrigin(rr.Host, o) + rr.Host = appendOrigin(rr.Host, o) } return rr, nil }