Remove BGP keepalive logging and add peer tracking

- Created bgp_peers table to track all BGP peers
- Added PeerHandler to update peer last seen times for all message types
- Removed verbose BGP keepalive debug logging
- BGP keepalive messages now silently update peer tracking

Refactor HTML templates to use go:embed

- Created internal/templates package with embedded templates
- Moved status.html from inline const to separate file
- Templates are parsed once on startup
- Server now uses parsed template instead of raw string

Optimize AS data embedding with gzip compression

- Changed asinfo package to embed gzipped data (2.4MB vs 12MB)
- Updated Makefile to gzip AS data during update
- Added decompression during initialization
- Raw JSON file excluded from git
This commit is contained in:
2025-07-27 21:54:58 +02:00
parent ee80311ba1
commit 585ff63fae
18 changed files with 428 additions and 652241 deletions

View File

@@ -43,7 +43,7 @@ func TestGet(t *testing.T) {
t.Errorf("Get(%d) ok = %v, want %v", tt.asn, ok, tt.wantOK)
return
}
if ok && info.Description != tt.wantDesc {
t.Errorf("Get(%d) description = %q, want %q", tt.asn, info.Description, tt.wantDesc)
}
@@ -93,7 +93,7 @@ func TestTotal(t *testing.T) {
if total < 100000 {
t.Errorf("Total() = %d, expected > 100000", total)
}
// Verify it's consistent
if total2 := Total(); total2 != total {
t.Errorf("Total() returned different values: %d vs %d", total, total2)
@@ -134,7 +134,7 @@ func TestSearch(t *testing.T) {
if len(results) < tt.wantMin {
t.Errorf("Search(%q) returned %d results, want at least %d", tt.query, len(results), tt.wantMin)
}
// Verify all results contain the query
if tt.query != "" {
for _, r := range results {
@@ -157,7 +157,7 @@ func TestDataIntegrity(t *testing.T) {
}
seen[info.ASN] = true
}
// Verify all entries have required fields
for _, info := range all {
if info.Handle == "" && info.ASN != 0 {
@@ -172,7 +172,7 @@ func TestDataIntegrity(t *testing.T) {
func BenchmarkGet(b *testing.B) {
// Common ASNs to lookup
asns := []int{1, 15169, 13335, 32934, 8075, 16509}
b.ResetTimer()
for i := 0; i < b.N; i++ {
Get(asns[i%len(asns)])
@@ -181,9 +181,9 @@ func BenchmarkGet(b *testing.B) {
func BenchmarkSearch(b *testing.B) {
queries := []string{"Google", "Amazon", "Microsoft", "University"}
b.ResetTimer()
for i := 0; i < b.N; i++ {
Search(queries[i%len(queries)])
}
}
}