remove these files, stay lean and mean

This commit is contained in:
Miek Gieben 2010-12-28 08:29:17 +01:00
parent f9f20203ad
commit 73cc848e00
8 changed files with 59 additions and 31 deletions

View File

@ -11,8 +11,6 @@ GOFILES=\
types.go\
dnssec.go\
edns.go\
server.go\
strconv.go\
include $(GOROOT)/src/Make.pkg
@ -21,7 +19,7 @@ include $(GOROOT)/src/Make.pkg
examples:
(cd examples; make)
progs: dnssectest keytest
progs: dnssectest keytest readtest
# too lazy to lookup how this works again in Makefiles
dnssectest: dnssectest.go $(GOFILES)
@ -29,3 +27,6 @@ dnssectest: dnssectest.go $(GOFILES)
keytest: keytest.go $(GOFILES)
6g -I _obj keytest.go && 6l -L _obj -o keytest keytest.6
readtest: readtest.go $(GOFILES)
6g -I _obj readtest.go && 6l -L _obj -o readtest readtest.6

1
TODO
View File

@ -1,6 +1,7 @@
Todo:
* parse RRs from strings AToRR()
* DNSSEC validation
* NSEC(3) secure denial of existence
* Unknown RRs
* fix os.Erros usage

27
keytest.go Normal file
View File

@ -0,0 +1,27 @@
package main
import (
"dns"
"fmt"
)
func main() {
key := new(dns.RR_DNSKEY)
key.Hdr.Name = "miek.nl"
key.Hdr.Rrtype = dns.TypeDNSKEY
key.Hdr.Class = dns.ClassINET
key.Hdr.Ttl = 3600
key.Flags = 256
key.Protocol = 3
key.Algorithm = dns.AlgRSASHA256
key.PubKey = "AwEAAcNEU67LJI5GEgF9QLNqLO1SMq1EdoQ6E9f85ha0k0ewQGCblyW2836GiVsm6k8Kr5ECIoMJ6fZWf3CQSQ9ycWfTyOHfmI3eQ/1Covhb2y4bAmL/07PhrL7ozWBW3wBfM335Ft9xjtXHPy7ztCbV9qZ4TVDTW/Iyg0PiwgoXVesz"
tag := key.KeyTag()
fmt.Printf("%v\n", key)
fmt.Printf("Wrong key tag: %d\n", tag)
m := new(dns.Msg)
m.Ns = make([]dns.RR, 1)
m.Ns[0] = key
m.Pack()
}

23
readtest.go Normal file
View File

@ -0,0 +1,23 @@
package main
import (
"dns"
"fmt"
)
func main() {
key := new(dns.RR_DNSKEY)
key.Hdr.Name = "miek.nl."
key.Hdr.Rrtype = dns.TypeDNSKEY
key.Hdr.Class = dns.ClassINET
key.Hdr.Ttl = 3600
key.Flags = 256
key.Protocol = 3
key.Algorithm = dns.AlgRSASHA256
key.PubKey = "AwEAAcNEU67LJI5GEgF9QLNqLO1SMq1EdoQ6E9f85ha0k0ewQGCblyW2836GiVsm6k8Kr5ECIoMJ6fZWf3CQSQ9ycWfTyOHfmI3eQ/1Covhb2y4bAmL/07PhrL7ozWBW3wBfM335Ft9xjtXHPy7ztCbV9qZ4TVDTW/Iyg0PiwgoXVesz"
fmt.Printf("%v\n", key)
s := "miek.nl. 3600 IN DNSKEY 256 3 8 AwEAAcNEU67LJI5GEgF9QLNqLO1SMq1EdoQ6E9f85ha0k0ewQGCblyW2836GiVsm6k8Kr5ECIoMJ6fZWf3CQSQ9ycWfTyOHfmI3eQ/1Covhb2y4bAmL/07PhrL7ozWBW3wBfM335Ft9xjtXHPy7ztCbV9qZ4TVDTW/Iyg0PiwgoXVesz"
dns.ParseString(s)
}

View File

@ -6,7 +6,8 @@
// A dns resolver is to be run as a seperate goroutine.
// For every reply the resolver answers by sending the
// received packet (with a possible error) back on the channel.
// A simple resolver can be setup with the following code:
//
// Basic usage pattern:
//
// res := new(Resolver)
// ch := NewQuerier(res) // start new resolver

View File

@ -1,7 +0,0 @@
// Server side. An receiver listen for incoming packets.
// If the packet is wellformed it is passed on to the channel.
// Otherwise a FORMERR is returned directly.
//
package dns
// TODO MG

View File

@ -1,20 +0,0 @@
package dns
// use scanner or ebnf
// Convert a string to an resource record. The string must fir on one line.
// miek.nl. 3600 IN A 192.168.1.1 // ok
// miek.nl. IN A 192.168.1.1 // ok, ttl may be omitted
// miek.nl. A 192.168.1.1 // ok, ttl and class omitted
// miek.nl. 3600 A 192.168.1.1 // ok, class omitted
// IN A 192.168.1.1 // not ok
func ParseString(s string) *RR {
// up to first whitespace is domainname
// next word is:
// <number> -> TTL
// IN|CH|HS -> Class
// <rest> -> Type
// When the type is seen, we can read the rest
// of the string in an rr-specific manner
return nil
}

View File

@ -15,6 +15,8 @@
// DNS RR types definitions. See RFC 1035/.../4034 and many more.
// To create quad-A record: "a.miek.nl" IN AAAA 2001:7b8:206:1:200:39ff:fe59:b187
//
// Basic usage pattern:
//
// import "net" // for IP functions
// r := new(RR_AAAA)
// r.AAAA = net.ParseIP("2001:7b8:206:1:200:39ff:fe59:b187").To16()