mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-02-26 16:57:08 +00:00
chore: add sourceGeoIP and sourceIPASN to metadata
This commit is contained in:
@@ -35,7 +35,7 @@ type Pool struct {
|
||||
offset netip.Addr
|
||||
cycle bool
|
||||
mux sync.Mutex
|
||||
host []C.Rule
|
||||
host []C.DomainMatcher
|
||||
ipnet netip.Prefix
|
||||
store store
|
||||
}
|
||||
@@ -66,8 +66,8 @@ func (p *Pool) LookBack(ip netip.Addr) (string, bool) {
|
||||
|
||||
// ShouldSkipped return if domain should be skipped
|
||||
func (p *Pool) ShouldSkipped(domain string) bool {
|
||||
for _, rule := range p.host {
|
||||
if match, _ := rule.Match(&C.Metadata{Host: domain}); match {
|
||||
for _, matcher := range p.host {
|
||||
if matcher.MatchDomain(domain) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,7 @@ func (p *Pool) restoreState() {
|
||||
|
||||
type Options struct {
|
||||
IPNet netip.Prefix
|
||||
Host []C.Rule
|
||||
Host []C.DomainMatcher
|
||||
|
||||
// Size sets the maximum number of entries in memory
|
||||
// and does not work if Persistence is true
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"github.com/metacubex/mihomo/component/profile/cachefile"
|
||||
"github.com/metacubex/mihomo/component/trie"
|
||||
C "github.com/metacubex/mihomo/constant"
|
||||
RP "github.com/metacubex/mihomo/rules/provider"
|
||||
|
||||
"github.com/metacubex/bbolt"
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -157,7 +156,7 @@ func TestPool_Skip(t *testing.T) {
|
||||
pools, tempfile, err := createPools(Options{
|
||||
IPNet: ipnet,
|
||||
Size: 10,
|
||||
Host: []C.Rule{RP.NewDomainSet(tree.NewDomainSet(), "")},
|
||||
Host: []C.DomainMatcher{tree.NewDomainSet()},
|
||||
})
|
||||
assert.Nil(t, err)
|
||||
defer os.Remove(tempfile)
|
||||
|
||||
Reference in New Issue
Block a user