Documentation ¶
Index ¶
- Variables
- func ValidAndSplitDomain(domain string) ([]string, bool)
- type DomainSet
- type DomainTrie
- func (t *DomainTrie[T]) Foreach(fn func(domain string, data T) bool)
- func (t *DomainTrie[T]) Insert(domain string, data T) error
- func (t *DomainTrie[T]) IsEmpty() bool
- func (t *DomainTrie[T]) NewDomainSet() *DomainSet
- func (t *DomainTrie[T]) Optimize()
- func (t *DomainTrie[T]) Search(domain string) *Node[T]
- type IPV6
- type IpCidrNode
- type IpCidrTrie
- type Node
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidDomain = errors.New("invalid domain")
ErrInvalidDomain means insert domain is invalid
View Source
var (
ErrorOverMaxValue = errors.New("the value don't over max value")
)
Functions ¶
func ValidAndSplitDomain ¶
Types ¶
type DomainSet ¶
type DomainSet struct {
// contains filtered or unexported fields
}
func ReadDomainSetBin ¶ added in v1.18.7
func (*DomainSet) MatchDomain ¶ added in v1.18.8
MatchDomain implements C.DomainMatcher
type DomainTrie ¶
type DomainTrie[T any] struct { // contains filtered or unexported fields }
DomainTrie contains the main logic for adding and searching nodes for domain segments. support wildcard domain (e.g *.google.com)
func (*DomainTrie[T]) Foreach ¶
func (t *DomainTrie[T]) Foreach(fn func(domain string, data T) bool)
func (*DomainTrie[T]) Insert ¶
func (t *DomainTrie[T]) Insert(domain string, data T) error
Insert adds a node to the trie. Support 1. www.example.com 2. *.example.com 3. subdomain.*.example.com 4. .example.com 5. +.example.com
func (*DomainTrie[T]) IsEmpty ¶ added in v1.18.8
func (t *DomainTrie[T]) IsEmpty() bool
func (*DomainTrie[T]) NewDomainSet ¶
func (t *DomainTrie[T]) NewDomainSet() *DomainSet
NewDomainSet creates a new *DomainSet struct, from a DomainTrie.
func (*DomainTrie[T]) Optimize ¶
func (t *DomainTrie[T]) Optimize()
func (*DomainTrie[T]) Search ¶
func (t *DomainTrie[T]) Search(domain string) *Node[T]
Search is the most important part of the Trie. Priority as: 1. static part 2. wildcard domain 2. dot wildcard domain
type IpCidrNode ¶
type IpCidrNode struct { Mark bool // contains filtered or unexported fields }
func NewIpCidrNode ¶
func NewIpCidrNode(mark bool, maxValue uint32) *IpCidrNode
type IpCidrTrie ¶
type IpCidrTrie struct {
// contains filtered or unexported fields
}
func NewIpCidrTrie ¶
func NewIpCidrTrie() *IpCidrTrie
func (*IpCidrTrie) AddIpCidrForString ¶
func (trie *IpCidrTrie) AddIpCidrForString(ipCidr string) error
func (*IpCidrTrie) IsContainForString ¶
func (trie *IpCidrTrie) IsContainForString(ipString string) bool
Click to show internal directories.
Click to hide internal directories.