Merge branch 'master' of github.com:miekg/dns
This commit is contained in:
commit
9c0ff1489b
2
dns.go
2
dns.go
|
@ -18,7 +18,7 @@
|
|||
//
|
||||
// r := new(dns.MX)
|
||||
// r.Hdr = dns.RR_Header{Name: "miek.nl.", Rrtype: dns.TypeMX, Class: dns.ClassINET, Ttl: 3600}
|
||||
// r.Pref = 10
|
||||
// r.Preference = 10
|
||||
// r.Mx = "mx.miek.nl."
|
||||
//
|
||||
// Or directly from a string:
|
||||
|
|
|
@ -201,7 +201,7 @@ func (k *DNSKEY) ToDS(h int) *DS {
|
|||
}
|
||||
|
||||
// Sign signs an RRSet. The signature needs to be filled in with
|
||||
// the values: Inception, Expiration, KeyTag, SignerName and Algorithm.
|
||||
// the values: OrigTtl, Inception, Expiration, KeyTag, SignerName and Algorithm.
|
||||
// The rest is copied from the RRset. Sign returns true when the signing went OK,
|
||||
// otherwise false.
|
||||
// There is no check if RRSet is a proper (RFC 2181) RRSet.
|
||||
|
@ -217,7 +217,9 @@ func (rr *RRSIG) Sign(k PrivateKey, rrset []RR) error {
|
|||
rr.Hdr.Rrtype = TypeRRSIG
|
||||
rr.Hdr.Name = rrset[0].Header().Name
|
||||
rr.Hdr.Class = rrset[0].Header().Class
|
||||
rr.OrigTtl = rrset[0].Header().Ttl
|
||||
if rr.OrigTtl == 0 { // If set don't override
|
||||
rr.OrigTtl = rrset[0].Header().Ttl
|
||||
}
|
||||
rr.TypeCovered = rrset[0].Header().Rrtype
|
||||
rr.TypeCovered = rrset[0].Header().Rrtype
|
||||
rr.Labels = uint8(CountLabel(rrset[0].Header().Name))
|
||||
|
|
4
kscan.go
4
kscan.go
|
@ -20,10 +20,10 @@ func (k *DNSKEY) NewPrivateKey(s string) (PrivateKey, error) {
|
|||
return k.ReadPrivateKey(strings.NewReader(s), "")
|
||||
}
|
||||
|
||||
// NewPrivateKey reads a private key from the io.Reader q. The string file is
|
||||
// ReadPrivateKey reads a private key from the io.Reader q. The string file is
|
||||
// only used in error reporting.
|
||||
// The public key must be
|
||||
// known, because some cryptographics algorithms embed the public inside the privatekey.
|
||||
// known, because some cryptographic algorithms embed the public inside the privatekey.
|
||||
func (k *DNSKEY) ReadPrivateKey(q io.Reader, file string) (PrivateKey, error) {
|
||||
m, e := parseKey(q, file)
|
||||
if m == nil {
|
||||
|
|
|
@ -110,7 +110,7 @@ func Split(s string) []int {
|
|||
if s == "." {
|
||||
return nil
|
||||
}
|
||||
idx := []int{0}
|
||||
idx := make([]int, 1, 3)
|
||||
off := 0
|
||||
end := false
|
||||
|
||||
|
|
8
msg.go
8
msg.go
|
@ -1602,10 +1602,12 @@ func Copy(r RR) RR {
|
|||
// Put the parts of the name in the compression map.
|
||||
func compressionLenHelper(c map[string]int, s string) {
|
||||
pref := ""
|
||||
lbs := SplitDomainName(s)
|
||||
lbs := Split(s)
|
||||
for j := len(lbs) - 1; j >= 0; j-- {
|
||||
c[lbs[j]+"."+pref] = 1 + len(pref) + len(lbs[j])
|
||||
pref = lbs[j] + "." + pref
|
||||
l := 1 + len(pref)
|
||||
pref = s[lbs[j]:]
|
||||
l += len(pref)
|
||||
c[pref] = l
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue