Files
sing-box-extended-mirror/adapter/rule.go
T

41 lines
708 B
Go
Raw Normal View History

2024-10-21 23:38:34 +08:00
package adapter
import (
C "github.com/sagernet/sing-box/constant"
"github.com/miekg/dns"
2024-10-21 23:38:34 +08:00
)
type HeadlessRule interface {
Match(metadata *InboundContext) bool
String() string
}
type Rule interface {
HeadlessRule
2025-03-29 17:24:34 +08:00
SimpleLifecycle
2024-10-21 23:38:34 +08:00
Type() string
Action() RuleAction
}
type DNSRule interface {
Rule
LegacyPreMatch(metadata *InboundContext) bool
2024-10-21 23:38:34 +08:00
WithAddressLimit() bool
MatchAddressLimit(metadata *InboundContext, response *dns.Msg) bool
2024-10-21 23:38:34 +08:00
}
type RuleAction interface {
Type() string
String() string
}
func IsFinalAction(action RuleAction) bool {
switch action.Type() {
case C.RuleActionTypeSniff, C.RuleActionTypeResolve, C.RuleActionTypeEvaluate:
2024-10-21 23:38:34 +08:00
return false
default:
return true
}
}