Fix very large SOA/TTL values
This commit is contained in:
parent
3f5f2ed026
commit
9c5c2ee96f
10
dns.go
10
dns.go
|
@ -105,12 +105,12 @@ func (e *Error) Error() string {
|
||||||
|
|
||||||
// An RR represents a resource record.
|
// An RR represents a resource record.
|
||||||
type RR interface {
|
type RR interface {
|
||||||
// Header returns the header of an resource record. The header contains
|
// Header returns the header of an resource record. The header contains
|
||||||
// everything up to the rdata.
|
// everything up to the rdata.
|
||||||
Header() *RR_Header
|
Header() *RR_Header
|
||||||
// String returns the text representation of the resource record.
|
// String returns the text representation of the resource record.
|
||||||
String() string
|
String() string
|
||||||
// Len returns the length (in octects) of the uncompressed RR in wire format.
|
// Len returns the length (in octects) of the uncompressed RR in wire format.
|
||||||
Len() int
|
Len() int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ func (h *RR_Header) String() string {
|
||||||
} else {
|
} else {
|
||||||
s += h.Name + "\t"
|
s += h.Name + "\t"
|
||||||
}
|
}
|
||||||
s = s + strconv.Itoa(int(h.Ttl)) + "\t"
|
s = s + strconv.FormatInt(int64(h.Ttl), 10) + "\t"
|
||||||
|
|
||||||
if _, ok := Class_str[h.Class]; ok {
|
if _, ok := Class_str[h.Class]; ok {
|
||||||
s += Class_str[h.Class] + "\t"
|
s += Class_str[h.Class] + "\t"
|
||||||
|
|
|
@ -421,3 +421,11 @@ b1slImA8YVJyuIDsj7kwzG7jnERNqnWxZ48AWkskmdHaVDP4BcelrTI3rMXdXF5D
|
||||||
fmt.Printf("%s\n", hip.String())
|
fmt.Printf("%s\n", hip.String())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// example.com. 1000 IN SOA master.example.com. admin.example.com. 1 4294967294 4294967293 4294967295 100
|
||||||
|
func ExampleSOA() {
|
||||||
|
s := "example.com. 1000 SOA master.example.com. admin.example.com. 1 4294967294 4294967293 4294967295 100"
|
||||||
|
if soa, err := NewRR(s); err == nil {
|
||||||
|
fmt.Printf("%s\n", soa.String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
12
types.go
12
types.go
|
@ -359,11 +359,11 @@ func (rr *RR_SOA) Header() *RR_Header {
|
||||||
|
|
||||||
func (rr *RR_SOA) String() string {
|
func (rr *RR_SOA) String() string {
|
||||||
return rr.Hdr.String() + rr.Ns + " " + rr.Mbox +
|
return rr.Hdr.String() + rr.Ns + " " + rr.Mbox +
|
||||||
" " + strconv.Itoa(int(rr.Serial)) +
|
" " + strconv.FormatInt(int64(rr.Serial), 10) +
|
||||||
" " + strconv.Itoa(int(rr.Refresh)) +
|
" " + strconv.FormatInt(int64(rr.Refresh), 10) +
|
||||||
" " + strconv.Itoa(int(rr.Retry)) +
|
" " + strconv.FormatInt(int64(rr.Retry), 10) +
|
||||||
" " + strconv.Itoa(int(rr.Expire)) +
|
" " + strconv.FormatInt(int64(rr.Expire), 10) +
|
||||||
" " + strconv.Itoa(int(rr.Minttl))
|
" " + strconv.FormatInt(int64(rr.Minttl), 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rr *RR_SOA) Len() int {
|
func (rr *RR_SOA) Len() int {
|
||||||
|
@ -605,7 +605,7 @@ func (rr *RR_RRSIG) String() string {
|
||||||
return rr.Hdr.String() + Rr_str[rr.TypeCovered] +
|
return rr.Hdr.String() + Rr_str[rr.TypeCovered] +
|
||||||
" " + strconv.Itoa(int(rr.Algorithm)) +
|
" " + strconv.Itoa(int(rr.Algorithm)) +
|
||||||
" " + strconv.Itoa(int(rr.Labels)) +
|
" " + strconv.Itoa(int(rr.Labels)) +
|
||||||
" " + strconv.Itoa(int(rr.OrigTtl)) +
|
" " + strconv.FormatInt(int64(rr.OrigTtl), 10) +
|
||||||
" " + timeToDate(rr.Expiration) +
|
" " + timeToDate(rr.Expiration) +
|
||||||
" " + timeToDate(rr.Inception) +
|
" " + timeToDate(rr.Inception) +
|
||||||
" " + strconv.Itoa(int(rr.KeyTag)) +
|
" " + strconv.Itoa(int(rr.KeyTag)) +
|
||||||
|
|
Loading…
Reference in New Issue