Documentation
¶
Index ¶
Constants ¶
View Source
const ( DefaultIPv4MapThreshold = 100000 // IPv4默认阈值:10万IP DefaultIPv6MapThreshold = 50000 // IPv6默认阈值:5万IP(IPv6范围通常较大) )
默认阈值常量
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Dynamic bool `json:"dynamic" yaml:"dynamic" ini:"dynamic"` // 是否支持动态添加规则
IPv4MapThreshold uint64 `json:"ipv4_map_threshold" yaml:"ipv4_map_threshold" ini:"ipv4_map_threshold"` // IPv4 Map模式阈值
IPv6MapThreshold uint64 `json:"ipv6_map_threshold" yaml:"ipv6_map_threshold" ini:"ipv6_map_threshold"` // IPv6 Map模式阈值
IPv4RuleSet IPRuleSet `json:"ipv4_rule_set" yaml:"ipv4_rule_set" ini:"ipv4_rule_set"`
IPv6RuleSet IPRuleSet `json:"ipv6_rule_set" yaml:"ipv6_rule_set" ini:"ipv6_rule_set"`
IPv4CacheTTL time.Duration `json:"ipv4_cache_ttl" yaml:"ipv4_cache_ttl" ini:"ipv4_cache_ttl"`
IPv6CacheTTL time.Duration `json:"ipv6_cache_ttl" yaml:"ipv6_cache_ttl" ini:"ipv6_cache_ttl"`
}
Config IP匹配器配置
type IPMatcher ¶
type IPMatcher struct {
// contains filtered or unexported fields
}
IPMatcher 主匹配器结构
func (*IPMatcher) AddIPv4Rule ¶
AddIPv4Rule 添加ipv4规则 对于单个的ip,都定义为离散ip 对于多个的ip,都定义为连续范围 后面在构建的时候再进行排序合并
func (*IPMatcher) AddIPv6Rule ¶
AddIPv6Rule 添加ipv6规则
Click to show internal directories.
Click to hide internal directories.