Read misc.httpmethod, misc.protocol and misc.port from their IANA registries #26
@@ -14,5 +14,7 @@
|
||||
- Hard tabs. No comment by default; delete a restatement, a rationale, history, or a file preamble.
|
||||
- One spelling per result: reject the other at `New`, and let the error name the spelling to use.
|
||||
- A standing choice a reader would relitigate goes under Decisions in the README, not in a comment.
|
||||
- Prose naming a source states what that source states: read the register's own field
|
||||
before paraphrasing it.
|
||||
- A README example is a `json` block that loads and renders as a category; `readme_test.go` runs every one.
|
||||
- Cyclomatic complexity is gated at 14: the table-shaped dispatches (`linkParent`, `compileTemplate`, `renderEdges`) sit at it and stay whole; a function that would pass it is decomposed.
|
||||
|
||||
@@ -43,6 +43,12 @@ replacement, and each removed path, column or flag.
|
||||
in. `misc.useragent` is the top-user-agents desktop and mobile lists with `browser`,
|
||||
`device` and `os` columns. `misc.car` keeps its makes and models in a `make` and a
|
||||
`model` column.
|
||||
- `misc.httpmethod`, `misc.protocol` and `misc.port` are IANA's registries as tables.
|
||||
`misc.httpmethod` is the eight methods RFC 9110 defines and PATCH, carrying
|
||||
`safe` and `idempotent` as `true` or `false`; `misc.protocol` the keyword, its
|
||||
`number` and its `name`, selectable by either; `misc.port` renders a TCP port number,
|
||||
with the IANA `service` name beside it, keeping the first service the registry
|
||||
describes for a port so a number selects one row.
|
||||
- `geo.SE` and `geo.US`: five linked tables per country, `region`, `municipality`,
|
||||
`locality`, `postal-code` and `street`, weighted by population and address counts
|
||||
and built from SCB, GeoNames, Trafikverket NVDB and the US Census Bureau, and an
|
||||
|
||||
@@ -16,9 +16,12 @@ Every shipped dataset, its source, its licence and the attribution it asks for.
|
||||
| `en_US/last-name.tsv` | Census Bureau surnames occurring 100 or more times, 2010 | public domain | none required | `data-import/names-us.py` |
|
||||
| `sv_SE/sex.tsv`, `sv_SE/birth-number.tsv`, `sv_SE/title.tsv`, `en_US/sex.tsv`, `en_US/title.tsv`, `misc/car.tsv` | curated; Skatteverket's test birth numbers are facts, and `car.tsv` waits for an international source (goal 10) | — | — | — |
|
||||
| `misc/currency.tsv` | [datasets/currency-codes](https://github.com/datasets/currency-codes); symbols from [Unicode CLDR](https://github.com/unicode-org/cldr) `en.xml` and `root.xml` | PDDL 1.0; [Unicode License v3](https://www.unicode.org/license.txt) | CLDR: "Copyright © 1991-2025 Unicode, Inc. Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the United States and other countries." | `data-import/currency.py` |
|
||||
| `misc/httpmethod.tsv` | [IANA HTTP Method Registry](https://www.iana.org/assignments/http-methods/) | [public domain](https://www.iana.org/help/licensing-terms) | none required | `data-import/httpmethod.py` |
|
||||
| `misc/httpstatus.tsv` | [IANA HTTP Status Code Registry](https://www.iana.org/assignments/http-status-codes/) | [public domain](https://www.iana.org/help/licensing-terms) | none required | `data-import/httpstatus.py` |
|
||||
| `misc/language.tsv` | [datasets/language-codes](https://github.com/datasets/language-codes), the [Library of Congress](https://www.loc.gov/standards/iso639-2/) ISO 639-2 register | [PDDL 1.0](https://opendatacommons.org/licenses/pddl/1-0/) | none required | `data-import/language.py` |
|
||||
| `misc/mimetype.tsv` | [mime-db](https://github.com/jshttp/mime-db), the IANA media type registry with filename extensions | [MIT](https://github.com/jshttp/mime-db/blob/master/LICENSE) | "Copyright (c) 2014 Jonathan Ong, Copyright (c) 2015-2022 Douglas Christopher Wilson" | `data-import/mimetype.py` |
|
||||
| `misc/port.tsv` | [IANA Service Name and Transport Protocol Port Number Registry](https://www.iana.org/assignments/service-names-port-numbers/) | [public domain](https://www.iana.org/help/licensing-terms) | none required | `data-import/port.py` |
|
||||
| `misc/protocol.tsv` | [IANA Protocol Numbers](https://www.iana.org/assignments/protocol-numbers/) | [public domain](https://www.iana.org/help/licensing-terms) | none required | `data-import/protocol.py` |
|
||||
| `misc/territory.tsv` | [datasets/country-codes](https://github.com/datasets/country-codes) | [PDDL 1.0](https://opendatacommons.org/licenses/pddl/1-0/) | none required | `data-import/territory.py` |
|
||||
| `misc/timezone.tsv` | [IANA tzdb](https://www.iana.org/time-zones) 2026d `zone.tab` and the standard offset of each zone; weights from [GeoNames](https://www.geonames.org/) `cities15000` populations | [public domain](https://data.iana.org/time-zones/tzdb/LICENSE); [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) | "Populations from GeoNames, www.geonames.org" | `data-import/timezone.py` |
|
||||
| `misc/useragent.tsv` | [top-user-agents](https://github.com/microlinkhq/top-user-agents) desktop and mobile lists | [MIT](https://github.com/microlinkhq/top-user-agents/blob/master/LICENSE.md) | "Copyright © 2020 Kiko Beats" | `data-import/useragent.py` |
|
||||
|
||||
@@ -162,14 +162,28 @@ Each locale carries `address`, `color`, `company`, `date`, `email`, `first-name`
|
||||
`username`, `version` and `word`, formatted per locale; `sv_SE` adds
|
||||
`personnummer` and `samordningsnummer`, `en_US` adds `ssn` and `itin`. `misc`
|
||||
carries `car`, `coordinate`, `creditcard` (Luhn-valid), `currency` (ISO 4217),
|
||||
`datetime` (RFC 3339), `emoji`, `httpstatus`, `language` (ISO 639-1, with its
|
||||
639-2/T code), `mac`, `mimetype`, `objectid`, `territory` (ISO 3166-1), `timezone`
|
||||
(IANA), `useragent` and `uuid` (v4). Many carry sub-fields — `misc.currency.symbol`,
|
||||
`misc.territory.alpha2`, `misc.httpstatus.code` — which `--list` shows. `car`,
|
||||
`currency`, `httpstatus`, `language`, `mimetype`, `territory`, `timezone` and
|
||||
`useragent` are [tables](#table), so `misc.territory[SE].capital` and
|
||||
`misc.currency[Euro].symbol` select a row; `car` and `useragent` carry no key or
|
||||
name, so they are drawn from rather than selected in.
|
||||
`datetime` (RFC 3339), `emoji`, `httpmethod`, `httpstatus`, `language` (ISO 639-1,
|
||||
with its 639-2/T code), `mac`, `mimetype`, `objectid`, `port`, `protocol`,
|
||||
`territory` (ISO 3166-1), `timezone` (IANA), `useragent` and `uuid` (v4). Many carry
|
||||
sub-fields — `misc.currency.symbol`, `misc.territory.alpha2`, `misc.httpstatus.code` —
|
||||
which `--list` shows. `car`, `currency`, `httpmethod`, `httpstatus`, `language`,
|
||||
`mimetype`, `port`, `protocol`, `territory`, `timezone` and `useragent` are
|
||||
[tables](#table), so `misc.territory[SE].capital` and `misc.currency[Euro].symbol`
|
||||
select a row; `car` and `useragent` carry no key or name, so they are drawn from rather
|
||||
than selected in.
|
||||
|
||||
`misc.httpmethod`, `misc.protocol` and `misc.port` are IANA's registries.
|
||||
`misc.httpmethod` is the eight methods RFC 9110 defines and PATCH; the register's
|
||||
other entries, WebDAV and DeltaV among them, do not ship. Its `safe` and
|
||||
`idempotent` are `true` or `false`, so a Go `bool` reads them, though `--format json`
|
||||
and `sql` write them as text, a table column carrying no datatype. `misc.protocol`
|
||||
carries a `number` and a `name`, the keyword itself where the register spells none out,
|
||||
and selects by either spelling.
|
||||
`misc.port` is the TCP assignments, rendering the number a port field holds with the
|
||||
IANA `service` beside it, and selecting by number alone. A draw spans the whole
|
||||
register, so pin `misc.port[443]` where a fixture needs a port a reader recognises;
|
||||
it stops at 49150, IANA assigning nothing above, so an ephemeral source port is
|
||||
`{int(49152,65535)}`.
|
||||
[`DATA-LICENSES.md`](DATA-LICENSES.md) names each table's source and licence.
|
||||
|
||||
`misc.timezone` is every zone tzdb gives a shipped territory, from one apiece for most
|
||||
@@ -1184,6 +1198,16 @@ the Development section below, and who ships a register the four above then draw
|
||||
worth more than the last rows of a table. Where no such link can hold the fact
|
||||
stays a column. Layer your own `misc.territory` over the shipped one and you
|
||||
must layer `misc.timezone` too, or the link fails at load naming the row.
|
||||
- **A table whose register publishes no frequency draws evenly.** `misc.httpmethod`,
|
||||
`misc.port`, `misc.httpstatus` and `misc.mimetype` weigh every row alike, so GET is
|
||||
a ninth of the methods drawn. Goal 10 keeps an authored fact out of a sourced table,
|
||||
and no register publishes how often a method or a port is used, so a weight here
|
||||
would be invented. Where one exists it is read, as `misc.timezone` reads GeoNames
|
||||
populations and `sv_SE.first-name` SCB bearers.
|
||||
- **`misc.port` selects by number, and carries no `name`.** 29 of its services sit on
|
||||
more than one port, `http-alt` on three, so `misc.port[http-alt]` could name no one
|
||||
row. The number is what a port field holds anyway, and `misc.port[443].service`
|
||||
reads the other way.
|
||||
- **`misc.car` is one flat table, not a make linked to its models.** A row is a make
|
||||
and a model drawn together, so no render pairs a Volvo with a RAV4. Two linked
|
||||
tables would reach the same pairs and add a selector nothing asks for; a make alone
|
||||
@@ -1296,11 +1320,14 @@ a copy of the surname file:
|
||||
docker compose run --rm --user "$(id -u):$(id -g)" data-import data-import/currency.py
|
||||
docker compose run --rm --user "$(id -u):$(id -g)" -e TRAFIKVERKET_API_KEY data-import data-import/geo-se.py
|
||||
docker compose run --rm --user "$(id -u):$(id -g)" data-import data-import/geo-us.py
|
||||
docker compose run --rm --user "$(id -u):$(id -g)" data-import data-import/httpmethod.py
|
||||
docker compose run --rm --user "$(id -u):$(id -g)" data-import data-import/httpstatus.py
|
||||
docker compose run --rm --user "$(id -u):$(id -g)" data-import data-import/language.py
|
||||
docker compose run --rm --user "$(id -u):$(id -g)" data-import data-import/mimetype.py
|
||||
docker compose run --rm --user "$(id -u):$(id -g)" data-import data-import/names-se.py
|
||||
docker compose run --rm --user "$(id -u):$(id -g)" data-import data-import/names-us.py
|
||||
docker compose run --rm --user "$(id -u):$(id -g)" data-import data-import/port.py
|
||||
docker compose run --rm --user "$(id -u):$(id -g)" data-import data-import/protocol.py
|
||||
docker compose run --rm --user "$(id -u):$(id -g)" data-import data-import/territory.py
|
||||
docker compose run --rm --user "$(id -u):$(id -g)" data-import data-import/timezone.py
|
||||
docker compose run --rm --user "$(id -u):$(id -g)" data-import data-import/useragent.py
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Rebuild data/misc/httpmethod.tsv from the IANA HTTP Method Registry.
|
||||
|
||||
data-import/httpmethod.py [--source URL_OR_FILE] [--cache DIR] [--out FILE]
|
||||
|
||||
A method ships when the register cites RFC 9110 section 9.3 or RFC 5789 for it, which
|
||||
is the eight HTTP defines and PATCH; the register's other entries do not. The
|
||||
register's `yes` and `no` ship as `true` and `false`, which a consumer's boolean reads.
|
||||
"""
|
||||
import argparse
|
||||
import csv
|
||||
import io
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import source
|
||||
import tsv
|
||||
|
||||
SOURCE = "https://www.iana.org/assignments/http-methods/methods.csv"
|
||||
OUT = Path(__file__).resolve().parent.parent / "data" / "misc" / "httpmethod.tsv"
|
||||
CACHE = Path(__file__).resolve().parent / "cache"
|
||||
COLUMNS = ["idempotent", "method", "safe"]
|
||||
CORE = re.compile(r"\[RFC9110, Section 9\.3\.|\[RFC5789, Section 2\]")
|
||||
BOOLEAN = {"yes": "true", "no": "false"}
|
||||
SELECTOR = '[]{}"|' # mirrors inSelector in table.go
|
||||
EXPECTED = 9
|
||||
|
||||
|
||||
def rows(text):
|
||||
for r in csv.DictReader(io.StringIO(text)):
|
||||
method = (r["Method Name"] or "").strip()
|
||||
if not CORE.search(r["Reference"] or ""):
|
||||
continue
|
||||
if set(method) & set(SELECTOR):
|
||||
sys.exit(f"{method}: a method holding one of {SELECTOR} is one a selector cannot spell")
|
||||
answers = {}
|
||||
for column in ("Safe", "Idempotent"):
|
||||
answer = (r[column] or "").strip()
|
||||
if answer not in BOOLEAN:
|
||||
sys.exit(f"{method}: {column} {answer!r} is neither yes nor no")
|
||||
answers[column] = BOOLEAN[answer]
|
||||
yield {"idempotent": answers["Idempotent"], "method": method, "safe": answers["Safe"]}
|
||||
|
||||
|
||||
def main():
|
||||
p = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
||||
p.add_argument("--cache", default=str(CACHE))
|
||||
p.add_argument("--source", default=SOURCE)
|
||||
p.add_argument("--out", default=str(OUT))
|
||||
a = p.parse_args()
|
||||
table = sorted(rows(source.fetch(a.source, a.cache, "http-methods.csv").decode("utf-8")), key=lambda r: r["method"])
|
||||
if len(table) != EXPECTED:
|
||||
sys.exit(f"{len(table)} methods cite RFC 9110 section 9.3 or RFC 5789, not {EXPECTED}; the register's Reference column has moved")
|
||||
tsv.write(a.out, COLUMNS, table)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Rebuild data/misc/port.tsv from the IANA Service Name and Transport Protocol Port Number Registry.
|
||||
|
||||
data-import/port.py [--source URL_OR_FILE] [--cache DIR] [--out FILE]
|
||||
|
||||
A row needs a service name and a numeric TCP port. A port the registry lists more than
|
||||
once keeps the first service it describes, or the first of them where it describes none,
|
||||
so a number selects one row.
|
||||
"""
|
||||
import argparse
|
||||
import csv
|
||||
import io
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import source
|
||||
import tsv
|
||||
|
||||
SOURCE = "https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.csv"
|
||||
OUT = Path(__file__).resolve().parent.parent / "data" / "misc" / "port.tsv"
|
||||
CACHE = Path(__file__).resolve().parent / "cache"
|
||||
COLUMNS = ["number", "service"]
|
||||
FLOOR = 4000
|
||||
|
||||
|
||||
def rows(text):
|
||||
best, described = {}, set()
|
||||
for r in csv.DictReader(io.StringIO(text)):
|
||||
service, number = (r["Service Name"] or "").strip(), (r["Port Number"] or "").strip()
|
||||
transport, description = (r["Transport Protocol"] or "").strip(), (r["Description"] or "").strip()
|
||||
if transport != "tcp" or not service or not number.isdigit():
|
||||
continue
|
||||
if not 1 <= int(number) <= 65535:
|
||||
sys.exit(f"{service}: port {number} is outside 1-65535")
|
||||
if number not in best or (description and number not in described):
|
||||
best[number] = {"number": number, "service": service}
|
||||
if description:
|
||||
described.add(number)
|
||||
return sorted(best.values(), key=lambda r: int(r["number"]))
|
||||
|
||||
|
||||
def main():
|
||||
p = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
||||
p.add_argument("--cache", default=str(CACHE))
|
||||
p.add_argument("--source", default=SOURCE)
|
||||
p.add_argument("--out", default=str(OUT))
|
||||
a = p.parse_args()
|
||||
table = rows(source.fetch(a.source, a.cache, "service-names-port-numbers.csv").decode("utf-8"))
|
||||
if len(table) < FLOOR:
|
||||
sys.exit(f"only {len(table)} ports named a TCP service; the registry's columns have moved")
|
||||
tsv.write(a.out, COLUMNS, table)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Rebuild data/misc/protocol.tsv from the IANA Protocol Numbers registry.
|
||||
|
||||
data-import/protocol.py [--source URL_OR_FILE] [--cache DIR] [--out FILE]
|
||||
|
||||
A row needs a number and a keyword, which drops the seven numbers assigned to a class of
|
||||
protocols rather than to one; a keyword the registry reserves or marks deprecated goes
|
||||
too. Where the registry names no protocol beside the keyword, the keyword is the name.
|
||||
"""
|
||||
import argparse
|
||||
import csv
|
||||
import io
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import source
|
||||
import tsv
|
||||
|
||||
SOURCE = "https://www.iana.org/assignments/protocol-numbers/protocol-numbers-1.csv"
|
||||
OUT = Path(__file__).resolve().parent.parent / "data" / "misc" / "protocol.tsv"
|
||||
CACHE = Path(__file__).resolve().parent / "cache"
|
||||
COLUMNS = ["keyword", "name", "number"]
|
||||
SKIP = ("Reserved", "deprecated")
|
||||
SELECTOR = '[]{}"|' # mirrors inSelector in table.go
|
||||
|
||||
|
||||
def rows(text):
|
||||
for r in csv.DictReader(io.StringIO(text)):
|
||||
number, keyword = (r["Decimal"] or "").strip(), (r["Keyword"] or "").strip()
|
||||
if not number.isdigit() or not keyword or any(s in keyword for s in SKIP):
|
||||
continue
|
||||
if not 0 <= int(number) <= 255:
|
||||
sys.exit(f"{keyword}: protocol number {number} is outside 0-255")
|
||||
yield {"keyword": keyword, "name": " ".join((r["Protocol"] or "").split()) or keyword, "number": number}
|
||||
|
||||
|
||||
def refuse_an_unselectable_row(table):
|
||||
"""What the loader refuses at New, and a name that names two rows rather than one."""
|
||||
keywords, names = {}, {}
|
||||
for r in table:
|
||||
for column in ("keyword", "name"):
|
||||
if set(r[column]) & set(SELECTOR):
|
||||
sys.exit(f"{r['keyword']}: {column} {r[column]!r} holds one of {SELECTOR}, which a selector cannot spell")
|
||||
if r["keyword"] in keywords:
|
||||
sys.exit(f"{r['keyword']}: repeats the keyword of protocol {keywords[r['keyword']]}")
|
||||
keywords[r["keyword"]] = r["number"]
|
||||
for r in table:
|
||||
if r["name"] != r["keyword"] and r["name"] in keywords:
|
||||
sys.exit(f"{r['keyword']}: name {r['name']!r} is another protocol's keyword")
|
||||
if r["name"] in names:
|
||||
sys.exit(f"{r['keyword']}: name {r['name']!r} repeats {names[r['name']]}'s, so it selects neither")
|
||||
names[r["name"]] = r["keyword"]
|
||||
|
||||
|
||||
def main():
|
||||
p = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
||||
p.add_argument("--cache", default=str(CACHE))
|
||||
p.add_argument("--source", default=SOURCE)
|
||||
p.add_argument("--out", default=str(OUT))
|
||||
a = p.parse_args()
|
||||
table = sorted(rows(source.fetch(a.source, a.cache, "protocol-numbers-1.csv").decode("utf-8")), key=lambda r: int(r["number"]))
|
||||
refuse_an_unselectable_row(table)
|
||||
tsv.write(a.out, COLUMNS, table)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1 @@
|
||||
{ "format": "{method}", "rows": "httpmethod.tsv", "key": "method" }
|
||||
@@ -0,0 +1,10 @@
|
||||
idempotent method safe
|
||||
false CONNECT false
|
||||
true DELETE false
|
||||
true GET true
|
||||
true HEAD true
|
||||
true OPTIONS true
|
||||
false PATCH false
|
||||
false POST false
|
||||
true PUT false
|
||||
true TRACE true
|
||||
|
@@ -0,0 +1 @@
|
||||
{ "format": "{number}", "rows": "port.tsv", "key": "number" }
|
||||
+5890
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
{ "format": "{keyword}", "rows": "protocol.tsv", "key": "keyword", "name": "name" }
|
||||
@@ -0,0 +1,140 @@
|
||||
keyword name number
|
||||
HOPOPT IPv6 Hop-by-Hop Option 0
|
||||
ICMP Internet Control Message 1
|
||||
IGMP Internet Group Management 2
|
||||
GGP Gateway-to-Gateway 3
|
||||
IPv4 IPv4 encapsulation 4
|
||||
ST Stream 5
|
||||
TCP Transmission Control 6
|
||||
CBT CBT 7
|
||||
EGP Exterior Gateway Protocol 8
|
||||
IGP any private interior gateway (used by Cisco for their IGRP) 9
|
||||
BBN-RCC-MON BBN RCC Monitoring 10
|
||||
NVP-II Network Voice Protocol 11
|
||||
PUP PUP 12
|
||||
EMCON EMCON 14
|
||||
XNET Cross Net Debugger 15
|
||||
CHAOS Chaos 16
|
||||
UDP User Datagram 17
|
||||
MUX Multiplexing 18
|
||||
DCN-MEAS DCN Measurement Subsystems 19
|
||||
HMP Host Monitoring 20
|
||||
PRM Packet Radio Measurement 21
|
||||
XNS-IDP XEROX NS IDP 22
|
||||
TRUNK-1 Trunk-1 23
|
||||
TRUNK-2 Trunk-2 24
|
||||
LEAF-1 Leaf-1 25
|
||||
LEAF-2 Leaf-2 26
|
||||
RDP Reliable Data Protocol 27
|
||||
IRTP Internet Reliable Transaction 28
|
||||
ISO-TP4 ISO Transport Protocol Class 4 29
|
||||
NETBLT Bulk Data Transfer Protocol 30
|
||||
MFE-NSP MFE Network Services Protocol 31
|
||||
MERIT-INP MERIT Internodal Protocol 32
|
||||
DCCP Datagram Congestion Control Protocol 33
|
||||
3PC Third Party Connect Protocol 34
|
||||
IDPR Inter-Domain Policy Routing Protocol 35
|
||||
XTP XTP 36
|
||||
DDP Datagram Delivery Protocol 37
|
||||
IDPR-CMTP IDPR Control Message Transport Proto 38
|
||||
TP++ TP++ Transport Protocol 39
|
||||
IL IL Transport Protocol 40
|
||||
IPv6 IPv6 encapsulation 41
|
||||
SDRP Source Demand Routing Protocol 42
|
||||
IPv6-Route Routing Header for IPv6 43
|
||||
IPv6-Frag Fragment Header for IPv6 44
|
||||
IDRP Inter-Domain Routing Protocol 45
|
||||
RSVP Reservation Protocol 46
|
||||
GRE Generic Routing Encapsulation 47
|
||||
DSR Dynamic Source Routing Protocol 48
|
||||
BNA BNA 49
|
||||
ESP Encap Security Payload 50
|
||||
AH Authentication Header 51
|
||||
I-NLSP Integrated Net Layer Security TUBA 52
|
||||
NARP NBMA Address Resolution Protocol 54
|
||||
Min-IPv4 Minimal IPv4 Encapsulation 55
|
||||
TLSP Transport Layer Security Protocol using Kryptonet key management 56
|
||||
SKIP SKIP 57
|
||||
IPv6-ICMP ICMP for IPv6 58
|
||||
IPv6-NoNxt No Next Header for IPv6 59
|
||||
IPv6-Opts Destination Options for IPv6 60
|
||||
CFTP CFTP 62
|
||||
SAT-EXPAK SATNET and Backroom EXPAK 64
|
||||
KRYPTOLAN Kryptolan 65
|
||||
RVD MIT Remote Virtual Disk Protocol 66
|
||||
IPPC Internet Pluribus Packet Core 67
|
||||
SAT-MON SATNET Monitoring 69
|
||||
VISA VISA Protocol 70
|
||||
IPCV Internet Packet Core Utility 71
|
||||
CPNX Computer Protocol Network Executive 72
|
||||
CPHB Computer Protocol Heart Beat 73
|
||||
WSN Wang Span Network 74
|
||||
PVP Packet Video Protocol 75
|
||||
BR-SAT-MON Backroom SATNET Monitoring 76
|
||||
SUN-ND SUN ND PROTOCOL-Temporary 77
|
||||
WB-MON WIDEBAND Monitoring 78
|
||||
WB-EXPAK WIDEBAND EXPAK 79
|
||||
ISO-IP ISO Internet Protocol 80
|
||||
VMTP VMTP 81
|
||||
SECURE-VMTP SECURE-VMTP 82
|
||||
VINES VINES 83
|
||||
IPTM Internet Protocol Traffic Manager 84
|
||||
NSFNET-IGP NSFNET-IGP 85
|
||||
DGP Dissimilar Gateway Protocol 86
|
||||
TCF TCF 87
|
||||
EIGRP EIGRP 88
|
||||
OSPFIGP OSPFIGP 89
|
||||
Sprite-RPC Sprite RPC Protocol 90
|
||||
LARP Locus Address Resolution Protocol 91
|
||||
MTP Multicast Transport Protocol 92
|
||||
AX.25 AX.25 Frames 93
|
||||
IPIP IP-within-IP Encapsulation Protocol 94
|
||||
SCC-SP Semaphore Communications Sec. Pro. 96
|
||||
ETHERIP Ethernet-within-IP Encapsulation 97
|
||||
ENCAP Encapsulation Header 98
|
||||
GMTP GMTP 100
|
||||
IFMP Ipsilon Flow Management Protocol 101
|
||||
PNNI PNNI over IP 102
|
||||
PIM Protocol Independent Multicast 103
|
||||
ARIS ARIS 104
|
||||
SCPS SCPS 105
|
||||
QNX QNX 106
|
||||
A/N Active Networks 107
|
||||
IPComp IP Payload Compression Protocol 108
|
||||
SNP Sitara Networks Protocol 109
|
||||
Compaq-Peer Compaq Peer Protocol 110
|
||||
IPX-in-IP IPX in IP 111
|
||||
VRRP Virtual Router Redundancy Protocol 112
|
||||
PGM PGM Reliable Transport Protocol 113
|
||||
L2TP Layer Two Tunneling Protocol 115
|
||||
DDX D-II Data Exchange (DDX) 116
|
||||
IATP Interactive Agent Transfer Protocol 117
|
||||
STP Schedule Transfer Protocol 118
|
||||
SRP SpectraLink Radio Protocol 119
|
||||
UTI UTI 120
|
||||
SMP Simple Message Protocol 121
|
||||
PTP Performance Transparency Protocol 123
|
||||
ISIS over IPv4 ISIS over IPv4 124
|
||||
FIRE FIRE 125
|
||||
CRTP Combat Radio Transport Protocol 126
|
||||
CRUDP Combat Radio User Datagram 127
|
||||
SSCOPMCE SSCOPMCE 128
|
||||
IPLT IPLT 129
|
||||
SPS Secure Packet Shield 130
|
||||
PIPE Private IP Encapsulation within IP 131
|
||||
SCTP Stream Control Transmission Protocol 132
|
||||
FC Fibre Channel 133
|
||||
RSVP-E2E-IGNORE RSVP-E2E-IGNORE 134
|
||||
Mobility Header Mobility Header 135
|
||||
UDPLite UDPLite 136
|
||||
MPLS-in-IP MPLS-in-IP 137
|
||||
manet MANET Protocols 138
|
||||
HIP Host Identity Protocol 139
|
||||
Shim6 Shim6 Protocol 140
|
||||
WESP Wrapped Encapsulating Security Payload 141
|
||||
ROHC Robust Header Compression 142
|
||||
Ethernet Ethernet 143
|
||||
AGGFRAG AGGFRAG encapsulation payload for ESP 144
|
||||
NSH Network Service Header 145
|
||||
Homa Homa 146
|
||||
BIT-EMU Bit-stream Emulation 147
|
||||
|
@@ -111,6 +111,14 @@ func TestShippedMiscReferenceData(t *testing.T) {
|
||||
"timezone.weight": regexp.MustCompile(`^[1-9]\d*$`),
|
||||
"mimetype": regexp.MustCompile(`^[a-z]+/[a-z0-9.+-]+$`),
|
||||
"mimetype.ext": regexp.MustCompile(`^\.[a-z0-9_-]+$`),
|
||||
"httpmethod": regexp.MustCompile(`^(CONNECT|DELETE|GET|HEAD|OPTIONS|PATCH|POST|PUT|TRACE)$`),
|
||||
"httpmethod.safe": regexp.MustCompile(`^(true|false)$`),
|
||||
"httpmethod.idempotent": regexp.MustCompile(`^(true|false)$`),
|
||||
"port": regexp.MustCompile(`^[1-9]\d{0,4}$`),
|
||||
"port.service": regexp.MustCompile(`^\S+$`),
|
||||
"protocol": regexp.MustCompile(`^\S+( \S+)*$`),
|
||||
"protocol.name": regexp.MustCompile(`\S`),
|
||||
"protocol.number": regexp.MustCompile(`^\d{1,3}$`),
|
||||
"httpstatus": regexp.MustCompile(`^[1-5]\d{2} \S.*$`),
|
||||
"httpstatus.code": regexp.MustCompile(`^[1-5]\d{2}$`),
|
||||
"useragent": regexp.MustCompile(`^Mozilla/5\.0 .+`),
|
||||
|
||||
@@ -701,6 +701,21 @@ func TestShippedTables(t *testing.T) {
|
||||
"timezone[Asia/Kathmandu].offset": "+05:45",
|
||||
"timezone[America/New_York].offset": "-05:00",
|
||||
"territory[SE].timezone": "Europe/Stockholm",
|
||||
"httpmethod[GET].safe": "true",
|
||||
"httpmethod[GET].idempotent": "true",
|
||||
"httpmethod[POST].safe": "false",
|
||||
"httpmethod[POST].idempotent": "false",
|
||||
"httpmethod[PUT].idempotent": "true",
|
||||
"protocol[TCP].number": "6",
|
||||
"protocol[UDP].number": "17",
|
||||
"protocol[ICMP].name": "Internet Control Message",
|
||||
"port[443]": "443",
|
||||
"port[443].service": "https",
|
||||
"port[22].service": "ssh",
|
||||
"port[3306].service": "mysql",
|
||||
"port[465].service": "urd",
|
||||
"port[2049].service": "nfs",
|
||||
"protocol[Transmission Control].number": "6",
|
||||
"territory[NP].timezone.offset": "+05:45",
|
||||
} {
|
||||
if got := fake(t, f, path); got != want {
|
||||
@@ -739,6 +754,22 @@ func TestShippedTables(t *testing.T) {
|
||||
t.Fatalf("%q: a territory and a timezone in one render disagree on the territory", got)
|
||||
}
|
||||
}
|
||||
var row struct {
|
||||
Idempotent bool `fake:"misc.httpmethod.idempotent"`
|
||||
Method string `fake:"misc.httpmethod.method"`
|
||||
Safe bool `fake:"misc.httpmethod.safe"`
|
||||
}
|
||||
if err := newGenerator(t, "data", WithSeed(1)).FakeStruct(&row); err != nil {
|
||||
t.Fatalf("FakeStruct into a bool = %v, want the register's yes and no shipped as true and false", err)
|
||||
}
|
||||
want, named := map[string][2]bool{
|
||||
"CONNECT": {false, false}, "DELETE": {false, true}, "GET": {true, true},
|
||||
"HEAD": {true, true}, "OPTIONS": {true, true}, "PATCH": {false, false},
|
||||
"POST": {false, false}, "PUT": {false, true}, "TRACE": {true, true},
|
||||
}[row.Method]
|
||||
if !named || row.Safe != want[0] || row.Idempotent != want[1] {
|
||||
t.Fatalf("%s drew safe=%v idempotent=%v", row.Method, row.Safe, row.Idempotent)
|
||||
}
|
||||
zones := map[string]int{}
|
||||
for i := 0; i < 2000; i++ {
|
||||
zones[fake(t, f, "territory[US].timezone")]++
|
||||
|
||||
Vendored
+11
@@ -229,6 +229,10 @@ misc.currency.numeric string
|
||||
misc.currency.symbol string
|
||||
misc.datetime format "{date(2000-01-01,2029-12-31,'2006-01-02T15:04:05Z')}"
|
||||
misc.emoji
|
||||
misc.httpmethod format "{method}" key method
|
||||
misc.httpmethod.idempotent string
|
||||
misc.httpmethod.method string
|
||||
misc.httpmethod.safe string
|
||||
misc.httpstatus format "{code} {reason}" key code name reason
|
||||
misc.httpstatus.code string
|
||||
misc.httpstatus.reason string
|
||||
@@ -241,6 +245,13 @@ misc.mimetype format "{type}" key type name ext
|
||||
misc.mimetype.ext string
|
||||
misc.mimetype.type string
|
||||
misc.objectid format "{hex(24)}"
|
||||
misc.port format "{number}" key number
|
||||
misc.port.number string
|
||||
misc.port.service string
|
||||
misc.protocol format "{keyword}" key keyword name name
|
||||
misc.protocol.keyword string
|
||||
misc.protocol.name string
|
||||
misc.protocol.number string
|
||||
misc.territory format "{name}" key alpha2 name name
|
||||
misc.territory.alpha2 string
|
||||
misc.territory.alpha3 string
|
||||
|
||||
@@ -9,7 +9,7 @@ Ordered as the releases that ship it.
|
||||
Shape: T = table, t = template, c = choice. Read every factual list from a register
|
||||
by a `data-import/` script, as README goal 10 asks.
|
||||
|
||||
- Add the remaining `misc` tables and templates from the table below.
|
||||
- Add the remaining `misc` tables and templates, one row of the table below per chunk.
|
||||
- Read `misc.emoji` from the Unicode `emoji-test.txt` register, and `misc.car` from an
|
||||
international make and model source; vPIC and Mobility Sweden are national, so they
|
||||
build `en_US.car` and `sv_SE.car`.
|
||||
@@ -46,7 +46,8 @@ by a `data-import/` script, as README goal 10 asks.
|
||||
|
||||
| Category | Shape | Source | Licence |
|
||||
|---|---|---|---|
|
||||
| `httpmethod`, `port`, `tld`, `protocol`, `loglevel` | T/c | IANA | CC0 |
|
||||
| `tld` | T | IANA root zone | CC0 |
|
||||
| `loglevel` | c | RFC 5424 severities | facts |
|
||||
| `ip` v4 documentation ranges, private, CIDR; `ipv6` `2001:db8::/32`; `mac` locally administered | t | RFC 5737, 1918, 9637 | facts |
|
||||
| `creditcard` per network: IIN, length, CVV, expiry | T+t | network rules, `{luhn()}` | facts |
|
||||
| `bic`, `isin`, `cusip` | t | structure rules | facts |
|
||||
@@ -102,6 +103,18 @@ by a `data-import/` script, as README goal 10 asks.
|
||||
- Add `{base64url(n)}` for JWT shapes.
|
||||
- Add a `unix` layout to `date()` once something needs it.
|
||||
|
||||
### Library and CLI
|
||||
|
||||
- Name a spelling that works when a row selector misses: `misc.protocol[tcp]`,
|
||||
`misc.httpmethod[get]` and `misc.territory[se]` all answer "no row … has key or name"
|
||||
and stop there, where a case-insensitive match could name the row that exists, and a
|
||||
table with no `name` column could say it selects by key alone.
|
||||
- Let a table column carry a `datatype`, so `--format json` writes
|
||||
`"safe": true` and `--format sql` a boolean rather than the text `'true'`. Today only
|
||||
a JSON field takes one, so `misc.httpmethod`'s booleans are typed in Go and text
|
||||
everywhere else. Typing a shipped column changes what `json` and `sql` write, so the
|
||||
capability is a minor and applying it to `misc.httpmethod` is a major.
|
||||
|
||||
### Open questions to settle
|
||||
|
||||
- Decide whether `misc.browser` becomes a parent of `misc.useragent`, so
|
||||
|
||||
Reference in New Issue
Block a user