Documentation
¶
Index ¶
- func AddrToUint32(ip netip.Addr) uint32
- func ExpandNetType(netType string) string
- func IsValidOrgName(name string) bool
- func ParseRange(rangeStr string) (uint32, uint32, error)
- func PrefixToRange(prefix string) (uint32, uint32, error)
- func Uint32ToAddr(ip uint32) netip.Addr
- type ARINDatabase
- type ASNXML
- type Database
- func (d *Database) Close() error
- func (d *Database) GetMetadata() (*Metadata, error)
- func (d *Database) GetOrganization(orgID string) (Organization, error)
- func (d *Database) IterateRanges(callback func(NetBlock) error) error
- func (d *Database) LookupIP(ip netip.Addr) (*Match, error)
- func (d *Database) LookupPrefix(prefix netip.Prefix) (*Match, error)
- func (d *Database) Stats() (netCount, orgCount int64, err error)
- type Error
- type Match
- type Metadata
- type NetBlock
- type NetBlockXML
- type NetBlocksXML
- type NetXML
- type OrgXML
- type Organization
- type POCXML
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddrToUint32 ¶
AddrToUint32 converts netip.Addr to uint32 (big-endian)
func ExpandNetType ¶
ExpandNetType returns a human-readable description of the net type
func IsValidOrgName ¶
IsValidOrgName filters out placeholder or administrative org names
func ParseRange ¶
ParseRange parses an IP range string like "8.0.0.0 - 8.255.255.255"
func PrefixToRange ¶
PrefixToRange converts a CIDR prefix to start/end uint32
func Uint32ToAddr ¶
Uint32ToAddr converts uint32 to netip.Addr (big-endian)
Types ¶
type ARINDatabase ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database manages the ARIN bulk data index
func BuildDatabase ¶
BuildDatabase creates a new ARIN bulk database from parsed data
func BuildDatabaseStreaming ¶
BuildDatabaseStreaming creates a new ARIN bulk database with low memory usage by writing organizations immediately and only keeping networks in memory for sorting
func OpenDatabase ¶
OpenDatabase opens an existing ARIN bulk database with default cache size
func OpenDatabaseWithCache ¶
OpenDatabaseWithCache opens with custom cache size (in bytes)
func (*Database) GetMetadata ¶
GetMetadata retrieves database metadata
func (*Database) GetOrganization ¶
func (d *Database) GetOrganization(orgID string) (Organization, error)
GetOrganization retrieves an organization by ID
func (*Database) IterateRanges ¶
IterateRanges iterates over all network ranges
func (*Database) LookupPrefix ¶
LookupPrefix finds the most specific network that exactly matches or contains the prefix
type Match ¶
type Match struct {
Start netip.Addr // Start IP
End netip.Addr // End IP
Prefix netip.Prefix // Query prefix
NetHandle string // ARIN net handle
OrgID string // Organization ID
OrgName string // Organization name
NetType string // Network type
NetName string // Network name
Country string // Country code
MatchedAt time.Time // When lookup was performed
FullyCovered bool // True if fully covers query
}
Match represents the result of a lookup
type Metadata ¶
type Metadata struct {
SchemaVersion int // Database schema version
BuildTime time.Time // When built
NetBlockCount int64 // Number of net blocks
OrgCount int64 // Number of organizations
SourceDate string // Date of ARIN bulk data
SourceURL string // Where data was fetched from
}
Metadata stores build information
type NetBlock ¶
type NetBlock struct {
Start uint32 // Start IP (big-endian uint32 for IPv4)
End uint32 // End IP (big-endian uint32 for IPv4)
NetName string // Network name
NetHandle string // ARIN net handle (e.g., NET-8-0-0-0-1)
OrgID string // Organization ID (e.g., LPL-141)
NetType string // Direct Allocation, Direct Assignment, etc.
ParentNet string // Parent network handle
CIDR []string // CIDR blocks (can be multiple)
Comments []string // Comments
UpdateDate string // Last updated date
}
NetBlock represents an ARIN network block (NetRange)
type NetBlockXML ¶
type NetBlocksXML ¶
type NetBlocksXML struct {
Blocks []NetBlockXML `xml:"netBlock"`
}
type NetXML ¶
type NetXML struct {
Handle string `xml:"handle"`
Name string `xml:"name"`
OrgHandle string `xml:"orgHandle"`
NetBlocks NetBlocksXML `xml:"netBlocks"`
ParentHandle string `xml:"parentNetHandle"`
RegDate string `xml:"registrationDate"`
UpdateDate string `xml:"updateDate"`
Version string `xml:"version"` // "4" or "6"
Comments []string `xml:"comment>line"`
}
type Organization ¶
type Organization struct {
OrgID string // Organization ID (e.g., LPL-141)
OrgName string // Organization name
Address string // Street address
City string
StateProv string // State/Province
PostalCode string
Country string
UpdateDate string
}
Organization represents an ARIN organization