LabelCount() made public and various other tweaks
This commit is contained in:
parent
79b926d862
commit
15bf984f3f
5
dns.go
5
dns.go
|
@ -93,8 +93,9 @@ func (h *RR_Header) String() string {
|
|||
return s
|
||||
}
|
||||
|
||||
// Return number of labels in a dname
|
||||
func labelCount(a string) (c int) {
|
||||
// Return number of labels in a domain name
|
||||
// Make it fqdn?
|
||||
func LabelCount(a string) (c uint8) {
|
||||
for _, v := range a {
|
||||
if v == '.' {
|
||||
c++
|
||||
|
|
|
@ -2,7 +2,6 @@ package dns
|
|||
|
||||
import (
|
||||
"testing"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
|
||||
|
@ -16,7 +15,6 @@ func TestKeyGen(t *testing.T) {
|
|||
key.Protocol = 3
|
||||
key.Algorithm = AlgRSASHA256
|
||||
key.Generate(512)
|
||||
fmt.Printf("Generated key: %v\n", key)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ func (s *RR_RRSIG) Sign(k PrivateKey, rrset RRset) bool {
|
|||
s.SignerName = k.Hdr.Name
|
||||
s.Algorithm = ??
|
||||
*/
|
||||
s.Labels = uint8(labelCount(rrset[0].Header().Name))
|
||||
s.Labels = LabelCount(rrset[0].Header().Name)
|
||||
s.TypeCovered = rrset[0].Header().Rrtype
|
||||
|
||||
sigwire := new(rrsigWireFmt)
|
||||
|
|
|
@ -23,7 +23,6 @@ func TestSecure(t *testing.T) {
|
|||
sig.TypeCovered = TypeSOA
|
||||
sig.Algorithm = AlgRSASHA256
|
||||
sig.Labels = 2
|
||||
// UTC LUL!
|
||||
sig.Expiration = 1296534305 // date -u '+%s' -d"2011-02-01 04:25:05"
|
||||
sig.Inception = 1293942305 // date -u '+%s' -d"2011-01-02 04:25:05"
|
||||
sig.OrigTtl = 14400
|
||||
|
|
Loading…
Reference in New Issue