gofmt
This commit is contained in:
parent
509912d4c4
commit
5917838cbb
|
@ -128,8 +128,8 @@ type Client struct {
|
|||
Retry bool // retry with TCP
|
||||
QueryChan chan *Request // read DNS request from this channel
|
||||
ReplyChan chan *Exchange // write the reply (together with the DNS request) to this channel
|
||||
ReadTimeout time.Duration // the net.Conn.SetReadTimeout value for new connections (ns)
|
||||
WriteTimeout time.Duration // the net.Conn.SetWriteTimeout value for new connections (ns)
|
||||
ReadTimeout time.Duration // the net.Conn.SetReadTimeout value for new connections (ns)
|
||||
WriteTimeout time.Duration // the net.Conn.SetWriteTimeout value for new connections (ns)
|
||||
TsigSecret map[string]string // secret(s) for Tsig map[<zonename>]<base64 secret>
|
||||
Hijacked net.Conn // if set the calling code takes care of the connection
|
||||
// LocalAddr string // Local address to use
|
||||
|
|
|
@ -54,10 +54,10 @@ func (dns *Msg) SetRcodeFormatError(request *Msg) {
|
|||
// SetUpdate makes the message a dynamic update packet. It
|
||||
// sets the ZONE section to: z, TypeSOA, classINET.
|
||||
func (dns *Msg) SetUpdate(z string) {
|
||||
dns.MsgHdr.Id = Id()
|
||||
dns.MsgHdr.Opcode = OpcodeUpdate
|
||||
dns.Question = make([]Question, 1)
|
||||
dns.Question[0] = Question{z, TypeSOA, ClassINET}
|
||||
dns.MsgHdr.Id = Id()
|
||||
dns.MsgHdr.Opcode = OpcodeUpdate
|
||||
dns.Question = make([]Question, 1)
|
||||
dns.Question[0] = Question{z, TypeSOA, ClassINET}
|
||||
}
|
||||
|
||||
// SetIxfr creates dns msg suitable for requesting an ixfr.
|
||||
|
|
54
dnssec.go
54
dnssec.go
|
@ -411,7 +411,7 @@ func (k *RR_DNSKEY) pubKeyCurve() *ecdsa.PublicKey {
|
|||
case ECDSAP384SHA384:
|
||||
c = elliptic.P384()
|
||||
}
|
||||
x, y := elliptic.Unmarshal(c,keybuf)
|
||||
x, y := elliptic.Unmarshal(c, keybuf)
|
||||
pubkey := new(ecdsa.PublicKey)
|
||||
pubkey.X = x
|
||||
pubkey.Y = y
|
||||
|
@ -484,32 +484,32 @@ func rawSignatureData(rrset RRset, s *RR_RRSIG) (buf []byte) {
|
|||
name := h.Name
|
||||
h.Name = strings.ToLower(h.Name)
|
||||
// 6.2. Canonical RR Form. (3) - domain rdata to lowercaser
|
||||
/*
|
||||
switch h.Rrtype {
|
||||
case TypeNS:
|
||||
r.(*RR_NS).Ns = strings.ToLower(r.(*RR_NS).Ns)
|
||||
case TypeCNAME:
|
||||
r.(*RR_CNAME).Cname = strings.ToLower(r.(*RR_CNAME).Cname)
|
||||
case TypeSOA:
|
||||
r.(*RR_SOA).Ns = strings.ToLower(r.(*RR_SOA).Ns)
|
||||
r.(*RR_SOA).Mbox = strings.ToLower(r.(*RR_SOA).Mbox)
|
||||
case TypeMB:
|
||||
case TypeMG:
|
||||
case TypeMR:
|
||||
case TypePTR:
|
||||
r.(*RR_PTR).Ptr = strings.ToLower(r.(*RR_PTR).Ptr)
|
||||
case TypeMINFO:
|
||||
case TypeMX:
|
||||
r.(*RR_MX).Mx = strings.ToLower(r.(*RR_MX).Mx)
|
||||
case TypeSIG:
|
||||
case TypeRRSIG:
|
||||
case TypeSRV:
|
||||
case TypeNSEC:
|
||||
r.(*RR_NSEC).NextDomain = strings.ToLower(r.(*RR_NSEC).NextDomain)
|
||||
case TypeNSEC3:
|
||||
r.(*RR_NSEC3).NextDomain = strings.ToLower(r.(*RR_NSEC3).NextDomain)
|
||||
}
|
||||
*/
|
||||
/*
|
||||
switch h.Rrtype {
|
||||
case TypeNS:
|
||||
r.(*RR_NS).Ns = strings.ToLower(r.(*RR_NS).Ns)
|
||||
case TypeCNAME:
|
||||
r.(*RR_CNAME).Cname = strings.ToLower(r.(*RR_CNAME).Cname)
|
||||
case TypeSOA:
|
||||
r.(*RR_SOA).Ns = strings.ToLower(r.(*RR_SOA).Ns)
|
||||
r.(*RR_SOA).Mbox = strings.ToLower(r.(*RR_SOA).Mbox)
|
||||
case TypeMB:
|
||||
case TypeMG:
|
||||
case TypeMR:
|
||||
case TypePTR:
|
||||
r.(*RR_PTR).Ptr = strings.ToLower(r.(*RR_PTR).Ptr)
|
||||
case TypeMINFO:
|
||||
case TypeMX:
|
||||
r.(*RR_MX).Mx = strings.ToLower(r.(*RR_MX).Mx)
|
||||
case TypeSIG:
|
||||
case TypeRRSIG:
|
||||
case TypeSRV:
|
||||
case TypeNSEC:
|
||||
r.(*RR_NSEC).NextDomain = strings.ToLower(r.(*RR_NSEC).NextDomain)
|
||||
case TypeNSEC3:
|
||||
r.(*RR_NSEC3).NextDomain = strings.ToLower(r.(*RR_NSEC3).NextDomain)
|
||||
}
|
||||
*/
|
||||
// 6.2. Canonical RR Form. (4) - wildcards
|
||||
// dont have to do anything
|
||||
|
||||
|
|
|
@ -237,15 +237,15 @@ func TestKeyRSA(t *testing.T) {
|
|||
sig.KeyTag = key.KeyTag()
|
||||
sig.SignerName = key.Hdr.Name
|
||||
|
||||
if err := sig.Sign(priv, []RR{soa}); err != nil {
|
||||
t.Logf("Failed to sign")
|
||||
t.Fail()
|
||||
return
|
||||
}
|
||||
if err := sig.Verify(key, []RR{soa}); err != nil {
|
||||
t.Logf("Failed to verify")
|
||||
t.Fail()
|
||||
}
|
||||
if err := sig.Sign(priv, []RR{soa}); err != nil {
|
||||
t.Logf("Failed to sign")
|
||||
t.Fail()
|
||||
return
|
||||
}
|
||||
if err := sig.Verify(key, []RR{soa}); err != nil {
|
||||
t.Logf("Failed to verify")
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
|
||||
func TestKeyToDS(t *testing.T) {
|
||||
|
|
12
edns.go
12
edns.go
|
@ -129,12 +129,12 @@ func (rr *RR_OPT) SetDo() {
|
|||
|
||||
// Nsid returns the NSID as hex character string.
|
||||
func (rr *RR_OPT) Nsid() string {
|
||||
for i := 0; i < len(rr.Option); i++ {
|
||||
if rr.Option[i].Code == OptionCodeNSID {
|
||||
return "NSID: " + rr.Option[i].Data
|
||||
}
|
||||
}
|
||||
return "Not found"
|
||||
for i := 0; i < len(rr.Option); i++ {
|
||||
if rr.Option[i].Code == OptionCodeNSID {
|
||||
return "NSID: " + rr.Option[i].Data
|
||||
}
|
||||
}
|
||||
return "Not found"
|
||||
}
|
||||
|
||||
// SetNsid sets the NSID from a hex character string.
|
||||
|
|
4
msg.go
4
msg.go
|
@ -53,8 +53,8 @@ var (
|
|||
ErrRRset error = &Error{Err: "invalid rrset"}
|
||||
ErrDenialNsec3 error = &Error{Err: "no NSEC3 records"}
|
||||
ErrDenialCe error = &Error{Err: "no matching closest encloser found"}
|
||||
ErrDenialNc error = &Error{Err: "no covering NSEC3 found for next closer"}
|
||||
ErrDenialSo error = &Error{Err: "no covering NSEC3 found for source of synthesis"}
|
||||
ErrDenialNc error = &Error{Err: "no covering NSEC3 found for next closer"}
|
||||
ErrDenialSo error = &Error{Err: "no covering NSEC3 found for source of synthesis"}
|
||||
)
|
||||
|
||||
// A manually-unpacked version of (id, bits).
|
||||
|
|
12
nsec3.go
12
nsec3.go
|
@ -129,31 +129,31 @@ func (m *Msg) Nsec3Verify(q Question) error {
|
|||
hashednc := HashName(nc, hash, iter, salt)
|
||||
if hashednc > firstlab && hashednc < nextdom {
|
||||
ncdenied = true
|
||||
break
|
||||
break
|
||||
}
|
||||
}
|
||||
if !ncdenied {
|
||||
return ErrDenialNc
|
||||
}
|
||||
|
||||
// Check if the source of synthesis is covered and thus denied
|
||||
// Check if the source of synthesis is covered and thus denied
|
||||
for _, nsec := range nsec3 {
|
||||
firstlab := strings.ToUpper(SplitLabels(nsec.Header().Name)[0])
|
||||
nextdom := strings.ToUpper(nsec.NextDomain)
|
||||
hashedso := HashName(so, hash, iter, salt)
|
||||
if hashedso > firstlab && hashedso < nextdom {
|
||||
sodenied = true
|
||||
break
|
||||
break
|
||||
}
|
||||
}
|
||||
if !sodenied {
|
||||
return ErrDenialSo
|
||||
}
|
||||
println("NSEC3 proof succesfully proofed")
|
||||
return nil
|
||||
println("NSEC3 proof succesfully proofed")
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
*/
|
||||
*/
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -143,8 +143,8 @@ type Server struct {
|
|||
Net string // if "tcp" it will invoke a TCP listener, otherwise an UDP one
|
||||
Handler Handler // handler to invoke, dns.DefaultServeMux if nil
|
||||
UDPSize int // default buffer to use to read incoming UDP messages
|
||||
ReadTimeout time.Duration // the net.Conn.SetReadTimeout value for new connections
|
||||
WriteTimeout time.Duration // the net.Conn.SetWriteTimeout value for new connections
|
||||
ReadTimeout time.Duration // the net.Conn.SetReadTimeout value for new connections
|
||||
WriteTimeout time.Duration // the net.Conn.SetWriteTimeout value for new connections
|
||||
TsigSecret map[string]string // secret(s) for Tsig map[<zonename>]<base64 secret>
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue