- Add handle and description columns to asns table - Look up ASN info using asinfo package when creating new ASNs - Remove noisy debug logging for individual route updates - Add IPv4/IPv6 route counters and update rate tracking - Log routing table statistics every 15 seconds with IPv4/IPv6 breakdown - Track updates per second for both IPv4 and IPv6 routes separately
48 lines
1.3 KiB
Go
48 lines
1.3 KiB
Go
package database
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// ASN represents an Autonomous System Number
|
|
type ASN struct {
|
|
ID uuid.UUID `json:"id"`
|
|
Number int `json:"number"`
|
|
Handle string `json:"handle"`
|
|
Description string `json:"description"`
|
|
FirstSeen time.Time `json:"first_seen"`
|
|
LastSeen time.Time `json:"last_seen"`
|
|
}
|
|
|
|
// Prefix represents an IP prefix (CIDR block)
|
|
type Prefix struct {
|
|
ID uuid.UUID `json:"id"`
|
|
Prefix string `json:"prefix"`
|
|
IPVersion int `json:"ip_version"` // 4 or 6
|
|
FirstSeen time.Time `json:"first_seen"`
|
|
LastSeen time.Time `json:"last_seen"`
|
|
}
|
|
|
|
// Announcement represents a BGP announcement
|
|
type Announcement struct {
|
|
ID uuid.UUID `json:"id"`
|
|
PrefixID uuid.UUID `json:"prefix_id"`
|
|
ASNID uuid.UUID `json:"asn_id"`
|
|
OriginASNID uuid.UUID `json:"origin_asn_id"`
|
|
Path string `json:"path"` // JSON-encoded AS path
|
|
NextHop string `json:"next_hop"`
|
|
Timestamp time.Time `json:"timestamp"`
|
|
IsWithdrawal bool `json:"is_withdrawal"`
|
|
}
|
|
|
|
// ASNPeering represents a peering relationship between two ASNs
|
|
type ASNPeering struct {
|
|
ID uuid.UUID `json:"id"`
|
|
FromASNID uuid.UUID `json:"from_asn_id"`
|
|
ToASNID uuid.UUID `json:"to_asn_id"`
|
|
FirstSeen time.Time `json:"first_seen"`
|
|
LastSeen time.Time `json:"last_seen"`
|
|
}
|