Documentation
¶
Index ¶
- func Build(feedsDir string, feedNames []string) (map[string]*model.SetData, error)
- func IsCIDR(s string) bool
- func IsIPv4(ipStr string) bool
- func IsIPv6(ipStr string) bool
- func ListAvailableFeeds(feedsDir string) ([]string, error)
- func LoadFeed(feedsDir, feedName string) (*model.SetData, error)
- func LoadSpecificFeed(feedsDir string, feedName string) ([]string, []string, []string, []string, error)
- func Merge(feeds map[string]*model.SetData) *model.SetData
- type FeedInfo
- type ParsedEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
Build loads all feed files and returns consolidated SetData This replaces the slow bash implementation with fast Go parsing
Performance: <2s for 50,000+ IPs (vs 45s in bash)
Features: - IPv4/IPv6 automatic separation - CIDR normalization - Comment and empty line filtering - Streaming parsing (memory efficient)
func ListAvailableFeeds ¶
ListAvailableFeeds returns a list of all available feed names
Types ¶
type FeedInfo ¶
FeedInfo represents metadata about a threat feed
func GetFeedStats ¶
GetFeedStats returns statistics about all feeds
type ParsedEntry ¶
type ParsedEntry struct {
IPv4 bool // true if IPv4, false if IPv6
IsCIDR bool // true if CIDR range, false if single IP
Value string // normalized IP or CIDR
}
ParsedEntry represents a parsed feed line
func ParseFeedLine ¶
func ParseFeedLine(line string) (*ParsedEntry, error)
ParseFeedLine parses a single line from a feed/blacklist/whitelist file Handles multiple formats:
- Plain IP: "1.2.3.4"
- CIDR: "1.2.3.0/24"
- With inline comment: "1.2.3.4 # some comment"
- With whitespace-separated fields: "1.2.3.4 reason timestamp"
Returns nil, nil for empty lines and comments (skip) Returns nil, error for invalid IPs/CIDRs
func ParseFeedLineSilent ¶
func ParseFeedLineSilent(line string) *ParsedEntry
ParseFeedLineSilent parses a line and returns nil for both skip and error cases Use this when you want to silently ignore invalid entries (like the original loader)
func ParseFeedLineStrict ¶
func ParseFeedLineStrict(line string) (*ParsedEntry, error)
ParseFeedLineStrict is like ParseFeedLine but returns error for invalid entries Use this when you want to know about parsing failures