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 (
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.

View File

@ -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
}

View File

@ -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