Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Setup ¶
func Setup(c *caddy.Controller) error
Setup parses the ipfilter configuration and returns the middleware handler.
Types ¶
type ByLength ¶
type ByLength []string
ByLength sorts strings by length and alphabetically (if same length)
type IPFConfig ¶
type IPFConfig struct {
Paths []IPPath
DBHandler *maxminddb.Reader // Database's handler if it gets opened.
}
IPFConfig holds the configuration for the ipfilter middleware.
type IPFilter ¶
type IPFilter struct {
Next httpserver.Handler
Config IPFConfig
}
IPFilter is a middleware for filtering clients based on their ip or country's ISO code.
type IPPath ¶
type IPPath struct {
PathScopes []string
BlockPage string
CountryCodes []string
Ranges []Range
IsBlock bool
Strict bool
}
IPPath holds the configuration of a single ipfilter block.
type OnlyCountry ¶
type OnlyCountry struct {
Country struct {
ISOCode string `maxminddb:"iso_code"`
} `maxminddb:"country"`
}
OnlyCountry is used to fetch only the country's code from 'mmdb'.
Click to show internal directories.
Click to hide internal directories.