chore: add sourceGeoIP and sourceIPASN to metadata

This commit is contained in:
wwqgtxx
2024-08-28 12:25:45 +08:00
parent 8483178524
commit 4fecf68b8b
17 changed files with 211 additions and 211 deletions

View File

@@ -1,6 +1,8 @@
package provider
import (
"net/netip"
C "github.com/metacubex/mihomo/constant"
P "github.com/metacubex/mihomo/constant/provider"
"github.com/metacubex/mihomo/rules/common"
@@ -35,6 +37,18 @@ func (rs *RuleSet) Match(metadata *C.Metadata) (bool, string) {
return false, ""
}
// MatchDomain implements C.DomainMatcher
func (rs *RuleSet) MatchDomain(domain string) bool {
ok, _ := rs.Match(&C.Metadata{Host: domain})
return ok
}
// MatchIp implements C.IpMatcher
func (rs *RuleSet) MatchIp(ip netip.Addr) bool {
ok, _ := rs.Match(&C.Metadata{DstIP: ip})
return ok
}
func (rs *RuleSet) Adapter() string {
return rs.adapter
}