Re-vendor the shared files from sneak/prompts at 0653579 (closes #52)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
Takes .golangci.yml, .dockerignore, .gitignore, .editorconfig, the workflow and REPO_POLICIES.md from sneak/prompts 0653579, with this repository's own entries after the shared content. Lint (golangci-lint v2.14.0) and test are Dockerfile phases that script/lint and script/test build alone with a new CACHEBUST value, keeping Go's and golangci-lint's caches; the image build depends on both. make fmt and make fmt-check also format the markdown with prettier, pinned in yarn.lock. The agent guidance moves to AGENTS.md. The Go code is fixed for what the new configuration finds, and the AS and prefix detail reads now return the rows' error after their loops. Model: opus-5-5
This commit is contained in:
+26
-19
@@ -1,4 +1,3 @@
|
||||
// Package database provides SQLite storage for BGP routing data.
|
||||
package database
|
||||
|
||||
import (
|
||||
@@ -9,6 +8,8 @@ import (
|
||||
|
||||
// ASN represents an Autonomous System Number with its metadata including
|
||||
// handle, description, WHOIS data, and first/last seen timestamps.
|
||||
//
|
||||
//nolint:tagliatelle // field names are the existing JSON API
|
||||
type ASN struct {
|
||||
ASN int `json:"asn"`
|
||||
Handle string `json:"handle"`
|
||||
@@ -36,37 +37,39 @@ type ASN struct {
|
||||
// Prefix represents an IP prefix (CIDR block) with its IP version (4 or 6)
|
||||
// and first/last seen timestamps.
|
||||
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"`
|
||||
ID uuid.UUID
|
||||
Prefix string
|
||||
IPVersion int // 4 or 6
|
||||
FirstSeen time.Time
|
||||
LastSeen time.Time
|
||||
}
|
||||
|
||||
// Announcement represents a BGP announcement or withdrawal event,
|
||||
// containing the prefix, AS path, origin ASN, peer ASN, next hop, and timestamp.
|
||||
type Announcement struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
PrefixID uuid.UUID `json:"prefix_id"`
|
||||
PeerASN int `json:"peer_asn"`
|
||||
OriginASN int `json:"origin_asn"`
|
||||
Path string `json:"path"` // JSON-encoded AS path
|
||||
NextHop string `json:"next_hop"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
IsWithdrawal bool `json:"is_withdrawal"`
|
||||
ID uuid.UUID
|
||||
PrefixID uuid.UUID
|
||||
PeerASN int
|
||||
OriginASN int
|
||||
Path string // JSON-encoded AS path
|
||||
NextHop string
|
||||
Timestamp time.Time
|
||||
IsWithdrawal bool
|
||||
}
|
||||
|
||||
// ASNPeering represents a peering relationship between two ASNs,
|
||||
// stored with the lower ASN as ASA and the higher as ASB.
|
||||
type ASNPeering struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
ASA int `json:"as_a"`
|
||||
ASB int `json:"as_b"`
|
||||
FirstSeen time.Time `json:"first_seen"`
|
||||
LastSeen time.Time `json:"last_seen"`
|
||||
ID uuid.UUID
|
||||
ASA int
|
||||
ASB int
|
||||
FirstSeen time.Time
|
||||
LastSeen time.Time
|
||||
}
|
||||
|
||||
// LiveRoute represents a route in the live routing table
|
||||
//
|
||||
//nolint:tagliatelle // field names are the existing JSON API
|
||||
type LiveRoute struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Prefix string `json:"prefix"`
|
||||
@@ -80,12 +83,16 @@ type LiveRoute struct {
|
||||
}
|
||||
|
||||
// PrefixDistribution represents the distribution of prefixes by mask length
|
||||
//
|
||||
//nolint:tagliatelle // field names are the existing JSON API
|
||||
type PrefixDistribution struct {
|
||||
MaskLength int `json:"mask_length"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
// IPInfo represents comprehensive IP information for the /ip endpoint
|
||||
//
|
||||
//nolint:tagliatelle // field names are the existing JSON API
|
||||
type IPInfo struct {
|
||||
IP string `json:"ip"`
|
||||
PTR []string `json:"ptr,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user