-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #914 from zonedb/ydnar/iana-special
Fetch SUDNs from IANA
- Loading branch information
Showing
52 changed files
with
3,637 additions
and
3,060 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
package build | ||
|
||
import ( | ||
"encoding/csv" | ||
"io" | ||
"os" | ||
"strings" | ||
|
||
"github.com/wsxiaoys/terminal/color" | ||
) | ||
|
||
const ( | ||
// https://www.iana.org/assignments/special-use-domain-names/special-use-domain-names.xhtml | ||
ianaSpecialUseURL = "https://www.iana.org/assignments/special-use-domain-names/special-use-domain.csv" | ||
ietfDataTrackerBaseURL = "https://datatracker.ietf.org/doc/" | ||
) | ||
|
||
// FetchSpecialUseDomainsFromIANA fetches special use domains from the IANA website. | ||
func FetchSpecialUseDomainsFromIANA(zones map[string]*Zone, addNew bool) error { | ||
res, err := Fetch(ianaSpecialUseURL) | ||
if err != nil { | ||
return err | ||
} | ||
defer res.Body.Close() | ||
r := csv.NewReader(res.Body) | ||
|
||
cols, err := r.Read() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
var zonesAdded, zonesModified int | ||
for { | ||
row, err := r.Read() | ||
if err == io.EOF { | ||
break | ||
} else if err != nil { | ||
return err | ||
} | ||
|
||
rec := make(map[string]string) | ||
for i := range cols { | ||
rec[cols[i]] = row[i] | ||
} | ||
|
||
// Mangle reference into IETF data tracker URL | ||
ref := strings.Trim(rec["Reference"], "[]") | ||
ref = strings.Replace(ref, "RFC-ietf-", "draft-", 1) | ||
infoURL := ietfDataTrackerBaseURL + strings.ToLower(ref) | ||
|
||
domain := Normalize(rec["Name"]) | ||
d := domain | ||
for d != "" { | ||
var added, modified bool | ||
z := zones[d] | ||
if z == nil { | ||
z = &Zone{Domain: d} | ||
if addNew { | ||
zones[d] = z | ||
added = true | ||
} | ||
} | ||
|
||
// Fix up metadata | ||
if !z.HasMetadata() || z.ParentDomain() != "" { | ||
if z.RegistryOperator != "IANA" { | ||
z.RegistryOperator = "IANA" | ||
modified = true | ||
} | ||
if z.InfoURL != infoURL && d == domain { | ||
z.InfoURL = infoURL | ||
modified = true | ||
} | ||
if z.AddTags("infrastructure", "closed") != 0 { | ||
modified = true | ||
} | ||
} | ||
|
||
if added { | ||
zonesAdded++ | ||
color.Fprintf(os.Stderr, "@{g}New zone @{g!}%s@{.}\t%s\n", d, infoURL) | ||
} else if modified { | ||
zonesModified++ | ||
color.Fprintf(os.Stderr, "@{y}Modified @{y!}%s@{.}\t%s\n", d, infoURL) | ||
} | ||
|
||
d = z.ParentDomain() | ||
} | ||
} | ||
|
||
color.Fprintf(os.Stderr, "@{.}Added %d and modified %d special domain (infrastructure) zone(s)\n", zonesAdded, zonesModified) | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"domain": "0.0.192.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"domain": "0.192.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "10.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc6761", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "16.172.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc6761", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "168.192.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc6761", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"domain": "169.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "17.172.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc6761", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "170.0.0.192.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc8880", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "171.0.0.192.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc8880", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"domain": "172.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "18.172.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc6761", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "19.172.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc6761", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"domain": "192.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "20.172.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc6761", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "21.172.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc6761", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "22.172.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc6761", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "23.172.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc6761", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "24.172.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc6761", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "25.172.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc6761", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "254.169.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc6762", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "26.172.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc6761", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "27.172.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc6761", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "28.172.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc6761", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "29.172.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc6761", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "30.172.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc6761", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "31.172.in-addr.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc6761", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "6tisch.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc9031", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"domain": "8.e.f.ip6.arpa", | ||
"registryOperator": "IANA", | ||
"infoURL": "https://datatracker.ietf.org/doc/rfc6762", | ||
"tags": [ | ||
"closed", | ||
"infrastructure" | ||
] | ||
} |
Oops, something went wrong.