Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ShouldFetch ¶
ShouldFetch returns true if the CacheTiem is up on a given list
Types ¶
type BlacklistedEntry ¶
type BlacklistedEntry struct { //Index is the main data held by this entry Index string //List is the source list List List //ExtraData contains extra information this blacklist source provides ExtraData map[string]interface{} }
BlacklistedEntry is an entry of a List with a given BlacklistedType
func NewBlacklistedEntry ¶
func NewBlacklistedEntry(index string, source List) BlacklistedEntry
NewBlacklistedEntry creates a new BlacklistedEntry
type BlacklistedEntryMap ¶
type BlacklistedEntryMap map[BlacklistedEntryType]chan BlacklistedEntry
BlacklistedEntryMap is a map of BlacklistedEntryTypes to go channels. This datatype is used for sending different types of BlacklistedEntry together.
func FetchAndValidateEntries ¶
func FetchAndValidateEntries(l List, errorsOut chan<- error) BlacklistedEntryMap
FetchAndValidateEntries fetches the entries from a given List, validates the entries coming from the list, and returns a channel consisting of the validated entries. errorHandler is used to handle any errors that arrise in the processing of the entries
func NewBlacklistedEntryMap ¶
func NewBlacklistedEntryMap(types ...BlacklistedEntryType) BlacklistedEntryMap
NewBlacklistedEntryMap creates a new BlacklistedEntryMap with a given set of BlacklistedEntryTypes
type BlacklistedEntryType ¶
type BlacklistedEntryType string
BlacklistedEntryType is a string representing which type of data is held in the Index field of a BlacklistedEntry
const BlacklistedHostnameType BlacklistedEntryType = "hostname"
BlacklistedHostnameType should be added to the metadata types array in order to return hostnames from a list
const BlacklistedIPType BlacklistedEntryType = "ip"
BlacklistedIPType should be added to the metadata types array in order to return ips from a list
const BlacklistedURLType BlacklistedEntryType = "url"
BlacklistedURLType should be added to the metadata types array in order to return hostnames from a list
type List ¶
type List interface { //GetMetadata returns the Metadata associated with this blacklist GetMetadata() Metadata //SetMetadata sets the Metadata associated with this blacklist SetMetadata(Metadata) //FetchData fetches the BlacklistedEntrys associated with this blacklist. //This function must close the channels supplied in the entryMap. //This function should not close errorsOut as it is part of a larger //pipeline. FetchData(entryMap BlacklistedEntryMap, errorsOut chan<- error) }
List provides an interface for fetching a list of blacklisted items
type Metadata ¶
type Metadata struct { //Name is the unique identifying name for the associated List Name string //Types is a list of the BlacklistedEntryTypes the associated List will produce Types []BlacklistedEntryType //LastUpdate is the unix timestamp corresponding to the latest fetch of this //blacklist LastUpdate int64 //CacheTime is the time in seconds the data from this list should be cached CacheTime int64 }
Metadata stores the name of the blacklist source as well as other pieces of metadata