Make the home page's AS name search work (closes #151)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
The AS Name Search card on the home page said the search was coming soon.
It now asks the new GET /api/v1/search/as?q=<text> and lists the matches
as links to their AS pages. asinfo.Search ignores case, returns the first
matches up to a limit in AS number order, and counts all matches. An
empty q answers 400.
When the database has no record of an AS, its page and /api/v1/as/{asn}
take its handle and description from asinfo and still list its prefixes.
They answer 404 only for an AS with no record, no asinfo entry and no
prefix. AS 0 means no known origin: it always answers 404, and the search
never lists it.
Model: opus-5-5
This commit was merged in pull request #164.
This commit is contained in:
@@ -56,15 +56,17 @@ Every route answers `HEAD` as it answers `GET`, without the body.
|
||||
|
||||
### Web Interface
|
||||
|
||||
- `GET /` - Home page (HTML): headline figures, and lookups by AS number and by
|
||||
IP address
|
||||
- `GET /` - Home page (HTML): headline figures, lookups by AS number and by IP
|
||||
address, and a search of AS names
|
||||
- `GET /status` - HTML status dashboard, which reads `/api/v1/stats`
|
||||
- `GET /status.json` - JSON statistics: feed, memory, database and route figures
|
||||
- `GET /.well-known/healthcheck.json` - Health check (JSON): 200 when the
|
||||
database answers and the RIS Live feed is connected, otherwise 503;
|
||||
`data.status` is `ok` or `error` and `data.checks` says which check failed
|
||||
- `GET /as/{asn}` - AS detail page (HTML): the prefixes the AS originates and
|
||||
its peers
|
||||
its peers. When the database has no record of the AS, its handle and
|
||||
description come from the AS list built into RouteWatch. The page then shows
|
||||
no first-seen date.
|
||||
- `GET /prefix/{prefix}/{length}` - Prefix detail page (HTML), such as
|
||||
`/prefix/192.0.2.0/24`: every live route for the prefix, one per peer, and its
|
||||
origin ASes
|
||||
@@ -93,9 +95,22 @@ Every route answers `HEAD` as it answers `GET`, without the body.
|
||||
and 404 when none of the addresses has a live route. A PTR lookup gets 2
|
||||
seconds; an address whose lookup takes longer is answered without PTR names.
|
||||
- `GET /api/v1/as/{asn}` - The AS and the prefixes it originates, IPv4 and IPv6
|
||||
apart, each with when its newest route was updated
|
||||
apart, each with when its newest route was updated. When the database has no
|
||||
record of the AS, its handle and description come from the AS list built into
|
||||
RouteWatch. The answer then has no `first_seen` or `last_seen`.
|
||||
- `GET /api/v1/prefix/{prefix}/{length}` - Every live route for the prefix, one
|
||||
per peer, and the same routes grouped by origin AS in `origins`
|
||||
- `GET /api/v1/search/as?q={text}` - Finds the ASes whose handle or description
|
||||
contains `{text}`, ignoring case. `data` holds:
|
||||
- `query`: `{text}` without its leading and trailing spaces
|
||||
- `total`: the number of ASes that match
|
||||
- `results`: the first 50 of them in AS number order, each with `asn`,
|
||||
`handle` and `description`
|
||||
|
||||
The search reads the AS list built into RouteWatch, not the database. The
|
||||
list comes from [ipverse/asn-info](https://github.com/ipverse/asn-info). A
|
||||
match can therefore be an AS that the database has no record of. A `q` that
|
||||
is missing, empty or only spaces answers 400.
|
||||
|
||||
A JSON answer is `{"status": "ok", "data": ...}`, or for an error
|
||||
`{"status": "error", "error": {"msg": ..., "code": ...}}`, and carries an
|
||||
@@ -106,13 +121,16 @@ took. The health check is the exception: its 503 answer is also
|
||||
A request that runs past its time limit answers 504: the limit is 30 seconds,
|
||||
and 4 seconds for the database reads behind `/status.json` and `/api/v1/stats`.
|
||||
An AS number, prefix or mask length that does not parse answers 400, as does a
|
||||
mask length out of range for its IP version. An AS the database does not hold,
|
||||
or a prefix with no live route, answers 404. The HTML pages give these errors as
|
||||
plain text. Under `/api/v1` and `/ip/`, a path no route matches answers 404 with
|
||||
the message `Not found`, and `POST`, `PUT`, `PATCH`, `DELETE`, `OPTIONS`,
|
||||
`TRACE` or `CONNECT` answers 405 with `Method not allowed`. A 500 answer says
|
||||
only `Internal server error`, and a host name that does not resolve only
|
||||
`could not resolve host name`; the detail goes to the log.
|
||||
mask length out of range for its IP version. An AS answers 404 when it is not in
|
||||
the AS list built into RouteWatch and the database has neither a record of it
|
||||
nor a live route it originates. AS 0 always answers 404, because it means no
|
||||
known origin. The AS name search never lists it. A prefix with no live route
|
||||
answers 404 too. The HTML pages give these errors as plain text. Under `/api/v1`
|
||||
and `/ip/`, a path no route matches answers 404 with the message `Not found`,
|
||||
and `POST`, `PUT`, `PATCH`, `DELETE`, `OPTIONS`, `TRACE` or `CONNECT` answers
|
||||
405 with `Method not allowed`. A 500 answer says only `Internal server error`,
|
||||
and a host name that does not resolve only `could not resolve host name`; the
|
||||
detail goes to the log.
|
||||
|
||||
Every answer carries `Strict-Transport-Security`, `Content-Security-Policy`,
|
||||
`X-Frame-Options`, `X-Content-Type-Options`, `Referrer-Policy` and
|
||||
|
||||
Reference in New Issue
Block a user