mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-02-26 16:57:08 +00:00
The original upstream does not support it, and there are many places in the current code that do not support it either. Removing it will help maintain consistency in behavior across different parts.
40 lines
644 B
Go
40 lines
644 B
Go
package common
|
|
|
|
import (
|
|
"strings"
|
|
|
|
C "github.com/metacubex/mihomo/constant"
|
|
)
|
|
|
|
type Domain struct {
|
|
Base
|
|
domain string
|
|
adapter string
|
|
}
|
|
|
|
func (d *Domain) RuleType() C.RuleType {
|
|
return C.Domain
|
|
}
|
|
|
|
func (d *Domain) Match(metadata *C.Metadata, helper C.RuleMatchHelper) (bool, string) {
|
|
return metadata.RuleHost() == d.domain, d.adapter
|
|
}
|
|
|
|
func (d *Domain) Adapter() string {
|
|
return d.adapter
|
|
}
|
|
|
|
func (d *Domain) Payload() string {
|
|
return d.domain
|
|
}
|
|
|
|
func NewDomain(domain string, adapter string) *Domain {
|
|
return &Domain{
|
|
Base: Base{},
|
|
domain: strings.ToLower(domain),
|
|
adapter: adapter,
|
|
}
|
|
}
|
|
|
|
var _ C.Rule = (*Domain)(nil)
|