cleanup api, dont export Year68

This commit is contained in:
Miek Gieben 2012-08-17 08:29:45 +02:00
parent 1bd41c4aab
commit 73b6d37885
6 changed files with 12 additions and 12 deletions

2
dns.go
View File

@ -68,7 +68,7 @@ import (
) )
const ( 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. DefaultMsgSize = 4096 // Standard default for larger than 512 packets.
UDPMsgSize = 512 // Default buffer size for servers receiving UDP packets. UDPMsgSize = 512 // Default buffer size for servers receiving UDP packets.
MaxMsgSize = 65536 // Largest possible DNS packet. MaxMsgSize = 65536 // Largest possible DNS packet.

View File

@ -424,10 +424,10 @@ func (s *RR_RRSIG) Verify(k *RR_DNSKEY, rrset []RR) error {
// if a signature period is valid. // if a signature period is valid.
func (s *RR_RRSIG) ValidityPeriod() bool { func (s *RR_RRSIG) ValidityPeriod() bool {
utc := time.Now().UTC().Unix() utc := time.Now().UTC().Unix()
modi := (int64(s.Inception) - utc) / Year68 modi := (int64(s.Inception) - utc) / year68
mode := (int64(s.Expiration) - utc) / Year68 mode := (int64(s.Expiration) - utc) / year68
ti := int64(s.Inception) + (modi * Year68) ti := int64(s.Inception) + (modi * year68)
te := int64(s.Expiration) + (mode * Year68) te := int64(s.Expiration) + (mode * year68)
return ti <= utc && utc <= te return ti <= utc && utc <= te
} }

2
msg.go
View File

@ -104,7 +104,7 @@ var Rr_str = map[uint16]string{
TypeWKS: "WKS", TypeWKS: "WKS",
TypeNS: "NS", TypeNS: "NS",
TypePTR: "PTR", TypePTR: "PTR",
TypeRT: "RT", TypeRT: "RT",
TypeSOA: "SOA", TypeSOA: "SOA",
TypeTXT: "TXT", TypeTXT: "TXT",
TypeSRV: "SRV", TypeSRV: "SRV",

View File

@ -1374,11 +1374,11 @@ func (rr *RR_WKS) Copy() RR {
// string representation used when printing the record. // string representation used when printing the record.
// It takes serial arithmetic (RFC 1982) into account. // It takes serial arithmetic (RFC 1982) into account.
func TimeToDate(t uint32) string { func TimeToDate(t uint32) string {
mod := ((int64(t) - time.Now().Unix()) / Year68) - 1 mod := ((int64(t) - time.Now().Unix()) / year68) - 1
if mod < 0 { if mod < 0 {
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") return ti.Format("20060102150405")
} }
@ -1390,11 +1390,11 @@ func DateToTime(s string) (uint32, error) {
if e != nil { if e != nil {
return 0, e return 0, e
} }
mod := (t.Unix() / Year68) - 1 mod := (t.Unix() / year68) - 1
if mod < 0 { if mod < 0 {
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 // saltString converts a NSECX salt to uppercase and

View File

@ -10,7 +10,7 @@ import (
// Zone represents a DNS zone. // Zone represents a DNS zone.
type Zone struct { type Zone struct {
Origin string // Origin of the zone 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 *radix.Radix // Zone data
} }

View File

@ -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} return nil, &ParseError{f, "bad RT Host", l}
} }
if rr.Host[ld-1] != '.' { if rr.Host[ld-1] != '.' {
rr.Host= appendOrigin(rr.Host, o) rr.Host = appendOrigin(rr.Host, o)
} }
return rr, nil return rr, nil
} }