build: delegate to asn2org for ASN list

This commit is contained in:
Vincent Bernat
2022-04-26 09:10:35 +02:00
parent 95be341904
commit f73b6f3b73
4 changed files with 6 additions and 103904 deletions

1
.gitignore vendored
View File

@@ -2,6 +2,7 @@
/test/
/inlet/flow/decoder/flow*.pb.go
/common/clickhousedb/mocks/
/orchestrator/clickhouse/data/asns.csv
/console/frontend/node_modules/
/console/data/frontend/

View File

@@ -17,6 +17,7 @@ export GO111MODULE=on
GENERATED = \
inlet/flow/decoder/flow-1.pb.go \
common/clickhousedb/mocks/mock_driver.go \
orchestrator/clickhouse/data/asns.csv \
console/data/frontend console/frontend/node_modules
.PHONY: all
@@ -74,18 +75,12 @@ console/data/frontend: $(shell $(LSFILES) console/frontend/src 2> /dev/null)
console/data/frontend: ; $(info $(M) building console frontend)
$Q cd console/frontend && yarn --silent build
# These files are versioned in Git, but we may want to update them.
orchestrator/clickhouse/data/protocols.csv:
orchestrator/clickhouse/data/asns.csv:
$Q curl -sL https://vincentbernat.github.io/asn2org/asns.csv | sed 's|,[^,]*$$||' > $@
orchestrator/clickhouse/data/protocols.csv: # We keep this one in Git
$Q curl -sL http://www.iana.org/assignments/protocol-numbers/protocol-numbers-1.csv \
| sed -nE -e "1 s/.*/proto,name,description/p" -e "2,$ s/^([0-9]+,[^ ,]+,[^\",]+),.*/\1/p" \
> $@
orchestrator/clickhouse/data/asns.csv:
$Q (curl -sL https://www.peeringdb.com/api/net \
| jq -r '.data[] | [.asn,.name] | @csv' \
; curl -sL https://bgp.potaroo.net/cidr/autnums.html \
| sed -n 's|.*>AS\([0-9]*\) *</a> \([^-][^,]*\).*|\1,"\2"|p') \
| LC_ALL=C sort -sn -t, -k1 -u \
| sed -e '1iasn,name' > $@
# Tests

File diff suppressed because it is too large Load Diff

View File

@@ -33,7 +33,7 @@ func TestHTTPEndpoints(t *testing.T) {
ContentType: "text/csv; charset=utf-8",
FirstLines: []string{
"asn,name",
`1,"LVLT-1"`,
`1,"Level 3 Communications, Inc."`,
},
}, {
URL: "/api/v0/orchestrator/clickhouse/init.sh",