Fix the inception printing
Still need to add serial arithmetic to the calculations
This commit is contained in:
parent
0ed946d772
commit
392f418a0e
|
@ -3,6 +3,7 @@ package dns
|
|||
import (
|
||||
"testing"
|
||||
"time"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
|
||||
|
@ -27,6 +28,20 @@ func TestResolver(t *testing.T) {
|
|||
t.Log("Failed to get an valid answer")
|
||||
t.Fail()
|
||||
}
|
||||
fmt.Printf("%v\n", in)
|
||||
|
||||
// ask something
|
||||
m.Question[0] = Question{"www.nlnetlabs.nl", TypeRRSIG, ClassINET}
|
||||
ch <- DnsMsg{m, nil}
|
||||
in = <-ch
|
||||
|
||||
if in.Dns.Rcode != RcodeSuccess {
|
||||
t.Log("Failed to get an valid answer")
|
||||
t.Fail()
|
||||
}
|
||||
fmt.Printf("%v\n", in)
|
||||
|
||||
|
||||
ch <- DnsMsg{nil, nil}
|
||||
time.Sleep(1.0e9)
|
||||
}
|
||||
|
|
21
types.go
21
types.go
|
@ -10,6 +10,7 @@ package dns
|
|||
import (
|
||||
"net"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Packet formats
|
||||
|
@ -379,14 +380,30 @@ type RR_RRSIG struct {
|
|||
func (rr *RR_RRSIG) Header() *RR_Header {
|
||||
return &rr.Hdr
|
||||
}
|
||||
|
||||
// Also, I might need more of these helper function
|
||||
// where to put them if there are more
|
||||
// Define a new interface??
|
||||
// needs serial stuff
|
||||
// starts when 1970 has been 68 years ago??
|
||||
func intToDate(t uint32) string {
|
||||
// als meer dan 68 jaar geleden, dan 68 jaar bij bedrag optellen
|
||||
// TODO
|
||||
ti := time.SecondsToUTC(int64(t))
|
||||
return ti.Format("20060102030405")
|
||||
}
|
||||
|
||||
|
||||
func (rr *RR_RRSIG) String() string {
|
||||
return rr.Hdr.String() +
|
||||
" " + rr_str[rr.TypeCovered] +
|
||||
" " + strconv.Itoa(int(rr.Algorithm)) +
|
||||
" " + strconv.Itoa(int(rr.Labels)) +
|
||||
" " + strconv.Itoa(int(rr.OrigTtl)) +
|
||||
" " + strconv.Itoa(int(rr.Expiration)) + // date calc! TODO
|
||||
" " + strconv.Itoa(int(rr.Inception)) + // date calc! TODO
|
||||
// " " + strconv.Itoa(int(rr.Expiration)) + // date calc! TODO
|
||||
" " + intToDate(rr.Expiration) +
|
||||
// " " + strconv.Itoa(int(rr.Inception)) + // date calc! TODO
|
||||
" " + intToDate(rr.Inception) +
|
||||
" " + strconv.Itoa(int(rr.KeyTag)) +
|
||||
" " + rr.SignerName +
|
||||
" " + rr.Sig
|
||||
|
|
Loading…
Reference in New Issue