filter

package
v1.2.3-sp3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDirCuckoo

func NewDirCuckoo() *cuckoo.Filter

NewDirCuckoo 极限容量约 100 万

func NewGenericCuckoo

func NewGenericCuckoo() *cuckoo.Filter

默认参数的过滤容器, 全局使用一个容易造成碰撞, 因此拆分成四个 NewGenericCuckoo 极限容量约 400 万

func NewPathCuckoo

func NewPathCuckoo() *cuckoo.Filter

NewPathCuckoo 极限容量约 200 万

func NewWebsiteCuckoo

func NewWebsiteCuckoo() *cuckoo.Filter

NewWebsiteCuckoo 极限容量约 40 万

Types

type Config

type Config struct {
	TTL           int64 `json:"ttl" yaml:"ttl"`                       // 去重时间窗,秒为单位
	CaseSensitive bool  `json:"case_sensitive" yaml:"case_sensitive"` // 是否对 URL 中的大小写敏感
	Hash          bool  `json:"hash" yaml:"hash"`                     // 是否将 URL hash 作为去重因素
	Query         bool  `json:"query" yaml:"query"`                   // 是否将 query 作为去重因素, 若为 true, 那么 ?a=b 和  ?a=c 将被视为两个链接
	Credential    bool  `json:"credential" yaml:"credential"`         // 是否将认证信息作为去重因素,若为 true, 登录前后的同一页面可能会被扫描两次
	Rewrite       bool  `json:"rewrite" yaml:"rewrite"`               // 是否启用 rewrite 识别
}

func NewDefaultConfig

func NewDefaultConfig() *Config

func (*Config) Clone

func (c *Config) Clone() *Config

type StringFilter

type StringFilter struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewFilter

func NewFilter() *StringFilter

func NewStringFilter

func NewStringFilter(config *Config, container *cuckoo.Filter) *StringFilter

func (*StringFilter) Exist

func (s *StringFilter) Exist(str string) bool

func (*StringFilter) Insert

func (s *StringFilter) Insert(str string) bool

返回值是 true,插入成功,false 容器满了, 无法继续添加

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL