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:
@@ -39,12 +39,16 @@ type ASPath struct {
|
||||
Set []int
|
||||
}
|
||||
|
||||
// NoOrigin is the origin AS of a route whose origin is not known. AS 0 is
|
||||
// reserved, so no AS has this number.
|
||||
const NoOrigin = 0
|
||||
|
||||
// Origin returns the AS that originated the route: the last AS of the
|
||||
// sequence, or 0 (none) when the path ends in a set of several members or is
|
||||
// sequence, or NoOrigin when the path ends in a set of several members or is
|
||||
// empty.
|
||||
func (p *ASPath) Origin() int {
|
||||
if len(p.Set) > 0 || len(p.Sequence) == 0 {
|
||||
return 0
|
||||
return NoOrigin
|
||||
}
|
||||
|
||||
return p.Sequence[len(p.Sequence)-1]
|
||||
|
||||
Reference in New Issue
Block a user