Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Enabled bool // Enable this plugin? DatabaseFilePath string // Path to ip2location database file AllowedCountries []string // Whitelist of countries to allow (ISO 3166-1 alpha-2) BlockedCountries []string // Blocklist of countries to be blocked (ISO 3166-1 alpha-2) DefaultAllow bool // If source matches neither blocklist nor whitelist, should it be allowed through? AllowPrivate bool // Allow requests from private / internal networks? DisallowedStatusCode int // HTTP status code to return for disallowed requests AllowedIPBlocks []string // List of whitelist CIDR BlockedIPBlocks []string // List of blocklisted CIDRs }
Config defines the plugin configuration.
func CreateConfig ¶
func CreateConfig() *Config
CreateConfig creates the default plugin configuration.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
func (Plugin) CheckAllowed ¶
CheckAllowed checks whether a given IP address is allowed according to the configured allowed countries.
func (Plugin) GetRemoteIPs ¶
GetRemoteIPs collects the remote IPs from the X-Forwarded-For and X-Real-IP headers.
Click to show internal directories.
Click to hide internal directories.