mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-16 15:02:22 +08:00
39 lines
606 B
Go
39 lines
606 B
Go
package adapter
|
|
|
|
import (
|
|
C "github.com/sagernet/sing-box/constant"
|
|
)
|
|
|
|
type HeadlessRule interface {
|
|
Match(metadata *InboundContext) bool
|
|
String() string
|
|
}
|
|
|
|
type Rule interface {
|
|
HeadlessRule
|
|
Service
|
|
Type() string
|
|
UpdateGeosite() error
|
|
Action() RuleAction
|
|
}
|
|
|
|
type DNSRule interface {
|
|
Rule
|
|
WithAddressLimit() bool
|
|
MatchAddressLimit(metadata *InboundContext) bool
|
|
}
|
|
|
|
type RuleAction interface {
|
|
Type() string
|
|
String() string
|
|
}
|
|
|
|
func IsFinalAction(action RuleAction) bool {
|
|
switch action.Type() {
|
|
case C.RuleActionTypeSniff, C.RuleActionTypeResolve:
|
|
return false
|
|
default:
|
|
return true
|
|
}
|
|
}
|