mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2025-12-19 16:30:07 +08:00
29 lines
512 B
Go
29 lines
512 B
Go
package fakeip
|
|
|
|
import (
|
|
C "github.com/metacubex/mihomo/constant"
|
|
)
|
|
|
|
type Skipper struct {
|
|
Host []C.DomainMatcher
|
|
Mode C.FilterMode
|
|
}
|
|
|
|
// ShouldSkipped return if domain should be skipped
|
|
func (p *Skipper) ShouldSkipped(domain string) bool {
|
|
should := p.shouldSkipped(domain)
|
|
if p.Mode == C.FilterWhiteList {
|
|
return !should
|
|
}
|
|
return should
|
|
}
|
|
|
|
func (p *Skipper) shouldSkipped(domain string) bool {
|
|
for _, matcher := range p.Host {
|
|
if matcher.MatchDomain(domain) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|