From 6997a526cab7c30335ebb9764869449710f4c472 Mon Sep 17 00:00:00 2001 From: kenshin Date: Sat, 27 Jul 2013 00:50:20 +0800 Subject: [PATCH 1/3] a new user of dns library in go --- README.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/README.markdown b/README.markdown index c46f1d0c..a981ffb1 100644 --- a/README.markdown +++ b/README.markdown @@ -29,6 +29,7 @@ A not-so-up-to-date-list-that-may-be-actually-current: * https://github.com/chuangbo/jianbing-dictionary-dns/tree/master/golang * http://www.dns-lg.com/ * https://github.com/fcambus/rrda +* https://github.com/kenshinx/godns * more? # Features From 68716ada83666a495a3e2ef3ad9f9a39cecda620 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Fri, 16 Aug 2013 22:18:21 -0700 Subject: [PATCH 2/3] Unused --- nsecx.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/nsecx.go b/nsecx.go index c12545c1..b98ee130 100644 --- a/nsecx.go +++ b/nsecx.go @@ -11,12 +11,6 @@ import ( "strings" ) -const ( - _ = iota - _NSEC3_NXDOMAIN - _NSEC3_NODATA -) - type saltWireFmt struct { Salt string `dns:"size-hex"` } From 52731e78c5889f79ef22cbb23178fe37bf575273 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Fri, 16 Aug 2013 22:20:09 -0700 Subject: [PATCH 3/3] Clean up the nsecx file Stuff never worked. Remove it for now --- nsecx.go | 65 -------------------------------------------------------- 1 file changed, 65 deletions(-) diff --git a/nsecx.go b/nsecx.go index b98ee130..8afe133f 100644 --- a/nsecx.go +++ b/nsecx.go @@ -52,68 +52,3 @@ func HashName(label string, ha uint8, iter uint16, salt string) string { } return unpackBase32(nsec3) } - -// Implement the HashNames method of Denialer -func (rr *NSEC3) HashNames(domain string) { - rr.Header().Name = strings.ToLower(HashName(rr.Header().Name, rr.Hash, rr.Iterations, rr.Salt)) + "." + domain - rr.NextDomain = HashName(rr.NextDomain, rr.Hash, rr.Iterations, rr.Salt) -} - -// Implement the Match method of Denialer -func (rr *NSEC3) Match(domain string) bool { - return strings.ToUpper(SplitDomainName(rr.Header().Name)[0]) == strings.ToUpper(HashName(domain, rr.Hash, rr.Iterations, rr.Salt)) -} - -// Implement the Match method of Denialer -func (rr *NSEC) Match(domain string) bool { - return strings.ToUpper(rr.Header().Name) == strings.ToUpper(domain) -} - -func (rr *NSEC3) MatchType(rrtype uint16) bool { - for _, t := range rr.TypeBitMap { - if t == rrtype { - return true - } - if t > rrtype { - return false - } - } - return false -} - -func (rr *NSEC) MatchType(rrtype uint16) bool { - for _, t := range rr.TypeBitMap { - if t == rrtype { - return true - } - if t > rrtype { - return false - } - } - return false -} - -// Cover checks if domain is covered by the NSEC3 record. Domain must be given in plain text (i.e. not hashed) -// TODO(mg): this doesn't loop around -// TODO(mg): make a CoverHashed variant? -func (rr *NSEC3) Cover(domain string) bool { - hashdom := strings.ToUpper(HashName(domain, rr.Hash, rr.Iterations, rr.Salt)) - nextdom := strings.ToUpper(rr.NextDomain) - owner := strings.ToUpper(SplitDomainName(rr.Header().Name)[0]) // The hashed part - apex := strings.ToUpper(HashName(strings.Join(SplitDomainName(rr.Header().Name)[1:], "."), rr.Hash, rr.Iterations, rr.Salt)) + "." // The name of the zone - // if nextdomain equals the apex, it is considered The End. So in that case hashdom is always less then nextdomain - if hashdom > owner && nextdom == apex { - return true - } - - if hashdom > owner && hashdom <= nextdom { - return true - } - - return false -} - -// Cover checks if domain is covered by the NSEC record. Domain must be given in plain text. -func (rr *NSEC) Cover(domain string) bool { - return false -}