File tree Expand file tree Collapse file tree 16 files changed +249
-16
lines changed
Expand file tree Collapse file tree 16 files changed +249
-16
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ linters:
1111 - unconvert
1212 - unused
1313 - usestdlibvars
14+ - exhaustive
1415
1516linters-settings :
1617 gci :
@@ -21,3 +22,5 @@ linters-settings:
2122 - default
2223 staticcheck :
2324 go : ' 1.21'
25+ exhaustive :
26+ default-signifies-exhaustive : true
Original file line number Diff line number Diff line change @@ -52,6 +52,8 @@ func (t Type) String() string {
5252 return "Redir"
5353 case TPROXY :
5454 return "TProxy"
55+ case TUNNEL :
56+ return "Tunnel"
5557 default :
5658 return "Unknown"
5759 }
Original file line number Diff line number Diff line change 11package constant
22
3+ const (
4+ RuleConfigDomain RuleConfig = "DOMAIN"
5+ RuleConfigDomainSuffix RuleConfig = "DOMAIN-SUFFIX"
6+ RuleConfigDomainKeyword RuleConfig = "DOMAIN-KEYWORD"
7+ RuleConfigGeoIP RuleConfig = "GEOIP"
8+ RuleConfigIPCIDR RuleConfig = "IP-CIDR"
9+ RuleConfigIPCIDR6 RuleConfig = "IP-CIDR6"
10+ RuleConfigSrcIPCIDR RuleConfig = "SRC-IP-CIDR"
11+ RuleConfigSrcPort RuleConfig = "SRC-PORT"
12+ RuleConfigDstPort RuleConfig = "DST-PORT"
13+ RuleConfigInboundPort RuleConfig = "INBOUND-PORT"
14+ RuleConfigProcessName RuleConfig = "PROCESS-NAME"
15+ RuleConfigProcessPath RuleConfig = "PROCESS-PATH"
16+ RuleConfigIPSet RuleConfig = "IPSET"
17+ RuleConfigRuleSet RuleConfig = "RULE-SET"
18+ RuleConfigScript RuleConfig = "SCRIPT"
19+ RuleConfigMatch RuleConfig = "MATCH"
20+ )
21+
22+ // Rule Config Type String represents a rule type in configuration files.
23+ type RuleConfig string
24+
325// Rule Type
426const (
527 Domain RuleType = iota
Original file line number Diff line number Diff line change @@ -88,6 +88,8 @@ func print(data Event) {
8888 log .Errorln (data .Payload )
8989 case DEBUG :
9090 log .Debugln (data .Payload )
91+ case SILENT :
92+ return
9193 }
9294}
9395
Original file line number Diff line number Diff line change 66 C "github.com/Dreamacro/clash/constant"
77)
88
9+ // Implements C.Rule
10+ var _ C.Rule = (* Domain )(nil )
11+
912type Domain struct {
1013 domain string
1114 adapter string
Original file line number Diff line number Diff line change 66 C "github.com/Dreamacro/clash/constant"
77)
88
9+ // Implements C.Rule
10+ var _ C.Rule = (* DomainKeyword )(nil )
11+
912type DomainKeyword struct {
1013 keyword string
1114 adapter string
Original file line number Diff line number Diff line change 66 C "github.com/Dreamacro/clash/constant"
77)
88
9+ // Implements C.Rule
10+ var _ C.Rule = (* DomainSuffix )(nil )
11+
912type DomainSuffix struct {
1013 suffix string
1114 adapter string
Original file line number Diff line number Diff line change 44 C "github.com/Dreamacro/clash/constant"
55)
66
7+ // Implements C.Rule
8+ var _ C.Rule = (* Match )(nil )
9+
710type Match struct {
811 adapter string
912}
Original file line number Diff line number Diff line change 77 C "github.com/Dreamacro/clash/constant"
88)
99
10+ // Implements C.Rule
11+ var _ C.Rule = (* GEOIP )(nil )
12+
1013type GEOIP struct {
1114 country string
1215 adapter string
Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ func WithIPCIDRNoResolve(noResolve bool) IPCIDROption {
2020 }
2121}
2222
23+ // Implements C.Rule
24+ var _ C.Rule = (* IPCIDR )(nil )
25+
2326type IPCIDR struct {
2427 ipnet * net.IPNet
2528 adapter string
You can’t perform that action at this time.
0 commit comments