Show figures of the routing table on the home page (closes #154)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
The home page gets cards for the newest and oldest kept route, the newest and oldest updated AS, the AS with the most prefixes, the ASes with a single prefix and fifteen well-known networks. Two more cards count the bogon announcements and the prefixes with several origin ASes. They link to the new pages /bogons and /multiple-origins, which list up to 1,000 entries each. The new package internal/bogon tells reserved prefixes and AS numbers, from the IANA special-purpose and address space registries. Table.Overview walks the table and lets the read lock go every 10,000 prefixes. The server works the cards out once a minute and serves that copy. A new index on asns(last_seen) finds the newest and oldest updated AS. Model: opus-5-5
This commit was merged in pull request #196.
This commit is contained in:
@@ -27,6 +27,12 @@ var prefixDetailHTML string
|
||||
//go:embed prefix_length.html
|
||||
var prefixLengthHTML string
|
||||
|
||||
//go:embed bogons.html
|
||||
var bogonsHTML string
|
||||
|
||||
//go:embed multiple_origins.html
|
||||
var multipleOriginsHTML string
|
||||
|
||||
// Templates contains all parsed templates
|
||||
type Templates struct {
|
||||
// Index is the template for the home page
|
||||
@@ -39,6 +45,11 @@ type Templates struct {
|
||||
PrefixDetail *template.Template
|
||||
// PrefixLength is the template for displaying prefixes by length
|
||||
PrefixLength *template.Template
|
||||
// Bogons is the template of the page that lists the bogon announcements
|
||||
Bogons *template.Template
|
||||
// MultipleOrigins is the template of the page that lists the prefixes
|
||||
// announced by more than one origin AS
|
||||
MultipleOrigins *template.Template
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -116,6 +127,18 @@ func initTemplates() {
|
||||
if err != nil {
|
||||
panic("failed to parse prefix length template: " + err.Error())
|
||||
}
|
||||
|
||||
defaultTemplates.Bogons, err = template.New("bogons").
|
||||
Funcs(funcs).Parse(bogonsHTML)
|
||||
if err != nil {
|
||||
panic("failed to parse bogons template: " + err.Error())
|
||||
}
|
||||
|
||||
defaultTemplates.MultipleOrigins, err = template.New("multipleOrigins").
|
||||
Funcs(funcs).Parse(multipleOriginsHTML)
|
||||
if err != nil {
|
||||
panic("failed to parse multiple origins template: " + err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
// Get returns the singleton Templates instance
|
||||
@@ -149,3 +172,14 @@ func PrefixDetailTemplate() *template.Template {
|
||||
func PrefixLengthTemplate() *template.Template {
|
||||
return Get().PrefixLength
|
||||
}
|
||||
|
||||
// BogonsTemplate returns the parsed template of the bogon announcements page
|
||||
func BogonsTemplate() *template.Template {
|
||||
return Get().Bogons
|
||||
}
|
||||
|
||||
// MultipleOriginsTemplate returns the parsed template of the page of prefixes
|
||||
// announced by more than one origin AS
|
||||
func MultipleOriginsTemplate() *template.Template {
|
||||
return Get().MultipleOrigins
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user