Documentation
¶
Overview ¶
Package asndb reads, writes and looks up the release-pinned autonomous-system table.
Index ¶
- Constants
- func AppendTSV(r io.Reader, family Family, table *Table) error
- func ValidateRelease(db *DB, now time.Time) error
- func ValidateReleaseWith(db *DB, now time.Time, limits ReleaseLimits) error
- func Write(w io.Writer, table Table) error
- type DB
- type Family
- type IPv4Range
- type IPv6Range
- type Operator
- type ReleaseLimits
- type Table
Constants ¶
const ( MinReleaseIPv4Ranges = 300_000 MinReleaseASNs = 50_000 MaxReleaseAge = 45 * 24 * time.Hour )
Variables ¶
This section is empty.
Functions ¶
func AppendTSV ¶
AppendTSV reads the five-column ip2asn TSV format (start, end, ASN, country, description), transparently accepting either plain text or gzip. Each source must be sorted and non-overlapping.
func ValidateRelease ¶
ValidateRelease applies the minimum-size and freshness checks used by generation and release signing.
func ValidateReleaseWith ¶
func ValidateReleaseWith(db *DB, now time.Time, limits ReleaseLimits) error
ValidateReleaseWith applies the same checks with an explicit policy.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB retains the uncompressed table so Lookup can binary-search its pointer-free sections without allocating.
func (*DB) ContentHash ¶
ContentHash is SHA-256 of the canonical uncompressed table payload.
func (*DB) IPv4RangeCount ¶
IPv4RangeCount returns the number of mapped IPv4 intervals, excluding ASN 0 gap entries.
func (*DB) IPv6RangeCount ¶
IPv6RangeCount returns the number of mapped IPv6 /64 intervals, excluding ASN 0 gap entries.
type IPv4Range ¶
IPv4Range and IPv6Range use inclusive endpoints. IPv6 ranges are indexed at /64 granularity.
type Operator ¶
Operator names one autonomous system. Country is an ISO 3166-1 alpha-2 code, or empty if unknown.
type ReleaseLimits ¶
ReleaseLimits makes the release sanity policy explicit and lets tests exercise its boundaries with small tables.
func DefaultReleaseLimits ¶
func DefaultReleaseLimits() ReleaseLimits
DefaultReleaseLimits returns the minimum production quality policy.