Update root zone info and add script for doing the update

This commit is contained in:
Tony Garnock-Jones 2016-09-09 15:12:55 -04:00
parent 806bc1c0fe
commit 3dbe108662
2 changed files with 67 additions and 26 deletions

41
fetch-root-zone.rkt Normal file
View File

@ -0,0 +1,41 @@
#lang racket
(require net/url)
(define records
(map (lambda (r) (string-split r "\t"))
(string-split (port->string
(get-pure-port
(string->url "http://www.internic.net/domain/root.zone")))
"\n")))
(define (split-host-str s)
(map string->bytes/utf-8 (string-split s ".")))
(define (split-ip-str s)
(list->vector (map string->number (string-split s "."))))
(pretty-write
`(list
,@(filter values
(for/list [(r records)]
(match r
[(list "."
""
""
ttl-str
"IN"
"NS"
(regexp #px"^(.+)\\.$" (list _ host-str)))
`(NS/ttl '()
',(split-host-str host-str)
,(string->number ttl-str))]
[(list (regexp #px"^([^.]+\\.root-servers\\.net)\\.$" (list _ host-str))
ttl-str
"IN"
"A"
ip-str)
`(A/ttl ',(split-host-str host-str)
',(split-ip-str ip-str)
,(string->number ttl-str))]
[_ #f])))))

View File

@ -62,32 +62,32 @@
(A '(#"subns" #"example") '#(127 0 0 2))))
(define test-roots
(list (A/ttl '(#"a" #"root-servers" #"net") '#(198 41 0 4) 3600000)
(A/ttl '(#"b" #"root-servers" #"net") '#(192 228 79 201) 3600000)
(A/ttl '(#"c" #"root-servers" #"net") '#(192 33 4 12) 3600000)
(A/ttl '(#"d" #"root-servers" #"net") '#(199 7 91 13) 3600000)
(A/ttl '(#"e" #"root-servers" #"net") '#(192 203 230 10) 3600000)
(A/ttl '(#"f" #"root-servers" #"net") '#(192 5 5 241) 3600000)
(A/ttl '(#"g" #"root-servers" #"net") '#(192 112 36 4) 3600000)
(A/ttl '(#"h" #"root-servers" #"net") '#(128 63 2 53) 3600000)
(A/ttl '(#"i" #"root-servers" #"net") '#(192 36 148 17) 3600000)
(A/ttl '(#"j" #"root-servers" #"net") '#(192 58 128 30) 3600000)
(A/ttl '(#"k" #"root-servers" #"net") '#(193 0 14 129) 3600000)
(A/ttl '(#"l" #"root-servers" #"net") '#(199 7 83 42) 3600000)
(A/ttl '(#"m" #"root-servers" #"net") '#(202 12 27 33) 3600000)
(NS/ttl '() '(#"a" #"root-servers" #"net") 3600000)
(NS/ttl '() '(#"b" #"root-servers" #"net") 3600000)
(NS/ttl '() '(#"c" #"root-servers" #"net") 3600000)
(NS/ttl '() '(#"d" #"root-servers" #"net") 3600000)
(NS/ttl '() '(#"e" #"root-servers" #"net") 3600000)
(NS/ttl '() '(#"f" #"root-servers" #"net") 3600000)
(NS/ttl '() '(#"g" #"root-servers" #"net") 3600000)
(NS/ttl '() '(#"h" #"root-servers" #"net") 3600000)
(NS/ttl '() '(#"i" #"root-servers" #"net") 3600000)
(NS/ttl '() '(#"j" #"root-servers" #"net") 3600000)
(NS/ttl '() '(#"k" #"root-servers" #"net") 3600000)
(NS/ttl '() '(#"l" #"root-servers" #"net") 3600000)
(NS/ttl '() '(#"m" #"root-servers" #"net") 3600000)))
(list (NS/ttl '() '(#"a" #"root-servers" #"net") 518400)
(NS/ttl '() '(#"b" #"root-servers" #"net") 518400)
(NS/ttl '() '(#"c" #"root-servers" #"net") 518400)
(NS/ttl '() '(#"d" #"root-servers" #"net") 518400)
(NS/ttl '() '(#"e" #"root-servers" #"net") 518400)
(NS/ttl '() '(#"f" #"root-servers" #"net") 518400)
(NS/ttl '() '(#"g" #"root-servers" #"net") 518400)
(NS/ttl '() '(#"h" #"root-servers" #"net") 518400)
(NS/ttl '() '(#"i" #"root-servers" #"net") 518400)
(NS/ttl '() '(#"j" #"root-servers" #"net") 518400)
(NS/ttl '() '(#"k" #"root-servers" #"net") 518400)
(NS/ttl '() '(#"l" #"root-servers" #"net") 518400)
(NS/ttl '() '(#"m" #"root-servers" #"net") 518400)
(A/ttl '(#"a" #"root-servers" #"net") '#(198 41 0 4) 518400)
(A/ttl '(#"b" #"root-servers" #"net") '#(192 228 79 201) 518400)
(A/ttl '(#"c" #"root-servers" #"net") '#(192 33 4 12) 518400)
(A/ttl '(#"d" #"root-servers" #"net") '#(199 7 91 13) 518400)
(A/ttl '(#"e" #"root-servers" #"net") '#(192 203 230 10) 518400)
(A/ttl '(#"f" #"root-servers" #"net") '#(192 5 5 241) 518400)
(A/ttl '(#"g" #"root-servers" #"net") '#(192 112 36 4) 518400)
(A/ttl '(#"h" #"root-servers" #"net") '#(198 97 190 53) 518400)
(A/ttl '(#"i" #"root-servers" #"net") '#(192 36 148 17) 518400)
(A/ttl '(#"j" #"root-servers" #"net") '#(192 58 128 30) 518400)
(A/ttl '(#"k" #"root-servers" #"net") '#(193 0 14 129) 518400)
(A/ttl '(#"l" #"root-servers" #"net") '#(199 7 83 42) 518400)
(A/ttl '(#"m" #"root-servers" #"net") '#(202 12 27 33) 518400)))
(define pathological-roots
(list (NS '(#"a") '(#"ns" #"b"))