Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
Namespace = "github_com/xiachufang/krakend-ipfilter"
)
Functions ¶
This section is empty.
Types ¶
type CIDRFilter ¶
type CIDRFilter struct {
// contains filtered or unexported fields
}
CIDRFilter is an ip filter base on cidranger
func (*CIDRFilter) Allow ¶
func (f *CIDRFilter) Allow(ip string) bool
Allow implement IPFilter.Allow 1. If the "allow" list is configured, only the IPs in the "allow" list are allowed access. All other IPs are denied access. 2. If the "deny" list is configured, the IPs in the "deny" list are denied access. 3. If both the "allow" and "deny" lists are configured, both rules are applied simultaneously.
type Config ¶
type Config struct { Deny []string `json:"deny"` Allow []string `json:"allow"` // header keys to parse real ip, default to []string{X-Forwarded-For, X-Real-Ip} IPHeaders []string `json:"ip_headers"` }
Config is config of ipfilter
func ParseConfig ¶
func ParseConfig(e config.ExtraConfig, logger logging.Logger) *Config
ParseConfig build ip filter's Config
type IPFilter ¶
IPFilter is a interface for allow or deny an ip
func NewIPFilter ¶
NewIPFilter create a cidranger base ip filter
type NoopFilter ¶
type NoopFilter struct{}
NoopFilter noop, allow always, never deny
func (*NoopFilter) Allow ¶
func (noop *NoopFilter) Allow(_ string) bool
Allow implement IPFilter.Allow
Click to show internal directories.
Click to hide internal directories.