Documentation ¶
Overview ¶
Package ipblocklist contains default implementation of the mtglib.IPBlocklist for mtg.
Please check documentation for mtglib.IPBlocklist interface to get an idea of this abstraction.
Index ¶
Constants ¶
const ( // DefaultFireholDownloadConcurrency defines a default max number of // concurrent downloads of ip blocklists for Firehol. DefaultFireholDownloadConcurrency = 1 // DefaultFireholUpdateEach defines a default time period when Firehol // requests updates of the blocklists. DefaultFireholUpdateEach = 6 * time.Hour )
Variables ¶
This section is empty.
Functions ¶
func NewNoop ¶
func NewNoop() mtglib.IPBlocklist
NewNoop returns a dummy ipblocklist which allows all incoming connections.
Types ¶
type Firehol ¶
type Firehol struct {
// contains filtered or unexported fields
}
Firehol is mtglib.IPBlocklist which uses lists from FireHOL: https://iplists.firehol.org/
It can use both local files and remote URLs. This is not necessary that blocklists should be taken from this website, we expect only compatible formats here.
Example of the format:
# this is a comment # to ignore 127.0.0.1 # you can specify an IP 10.0.0.0/8 # or cidr
func NewFirehol ¶
func NewFirehol(logger mtglib.Logger, network mtglib.Network, downloadConcurrency uint, urls []string, localFiles []string, updateCallback FireholUpdateCallback, ) (*Firehol, error)
NewFirehol creates a new instance of FireHOL IP blocklist.
This method does not start an update process so please execute Run when it is necessary.
func NewFireholFromFiles ¶ added in v2.1.3
func NewFireholFromFiles(logger mtglib.Logger, downloadConcurrency uint, blocklists []files.File, updateCallback FireholUpdateCallback, ) (*Firehol, error)
NewFirehol creates a new instance of FireHOL IP blocklist.
This method creates this instances from a given list of files.
type FireholUpdateCallback ¶ added in v2.1.5
FireholUpdateCallback defines a signature of the callback that has to be execute when ip list is updated.