Formatting
This commit is contained in:
parent
f44bf2d656
commit
87845a9cb1
6
msg.go
6
msg.go
|
@ -771,7 +771,7 @@ func unpackBase64(b []byte) string {
|
||||||
|
|
||||||
// Helper function for packing, mostly used in dnssec.go
|
// Helper function for packing, mostly used in dnssec.go
|
||||||
func packUint16(i uint16) (byte, byte) {
|
func packUint16(i uint16) (byte, byte) {
|
||||||
return byte(i >> 8), byte(i)
|
return byte(i >> 8), byte(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
func packBase64(s []byte) ([]byte, os.Error) {
|
func packBase64(s []byte) ([]byte, os.Error) {
|
||||||
|
@ -1026,8 +1026,8 @@ func (dns *Msg) String() string {
|
||||||
if len(dns.Question) > 0 {
|
if len(dns.Question) > 0 {
|
||||||
s += "\n;; QUESTION SECTION:\n"
|
s += "\n;; QUESTION SECTION:\n"
|
||||||
for i := 0; i < len(dns.Question); i++ {
|
for i := 0; i < len(dns.Question); i++ {
|
||||||
// Need check if it exists? TODO(mg)
|
// Need check if it exists? TODO(mg)
|
||||||
s += dns.Question[i].String() + "\n"
|
s += dns.Question[i].String() + "\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(dns.Answer) > 0 {
|
if len(dns.Answer) > 0 {
|
||||||
|
|
22
nsec3.go
22
nsec3.go
|
@ -31,27 +31,27 @@ func HashName(label string, ha int, iterations int, salt string) string {
|
||||||
switch ha {
|
switch ha {
|
||||||
case HashSHA1:
|
case HashSHA1:
|
||||||
s = sha1.New()
|
s = sha1.New()
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// k = 0
|
// k = 0
|
||||||
name = append(name, wire...)
|
name = append(name, wire...)
|
||||||
io.WriteString(s, string(name))
|
io.WriteString(s, string(name))
|
||||||
nsec3 := s.Sum()
|
nsec3 := s.Sum()
|
||||||
// k > 0
|
// k > 0
|
||||||
for k := 0; k < iterations; k++ {
|
for k := 0; k < iterations; k++ {
|
||||||
s.Reset()
|
s.Reset()
|
||||||
nsec3 = append(nsec3, wire...)
|
nsec3 = append(nsec3, wire...)
|
||||||
io.WriteString(s, string(nsec3))
|
io.WriteString(s, string(nsec3))
|
||||||
nsec3 = s.Sum()
|
nsec3 = s.Sum()
|
||||||
}
|
}
|
||||||
return unpackBase32(nsec3)
|
return unpackBase32(nsec3)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hash the ownername and the next owner name in
|
// Hash the ownername and the next owner name in
|
||||||
// an NSEC3 record, use the parameters from the NSEC3 itself.
|
// an NSEC3 record, use the parameters from the NSEC3 itself.
|
||||||
func (nsec3 *RR_NSEC3) HashNames() {
|
func (nsec3 *RR_NSEC3) HashNames() {
|
||||||
nsec3.Header().Name = HashName(nsec3.Header().Name, int(nsec3.Hash), int(nsec3.Iterations), nsec3.Salt)
|
nsec3.Header().Name = HashName(nsec3.Header().Name, int(nsec3.Hash), int(nsec3.Iterations), nsec3.Salt)
|
||||||
nsec3.NextDomain = HashName(nsec3.NextDomain, int(nsec3.Hash), int(nsec3.Iterations), nsec3.Salt)
|
nsec3.NextDomain = HashName(nsec3.NextDomain, int(nsec3.Hash), int(nsec3.Iterations), nsec3.Salt)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue