@@ -22,23 +22,23 @@ func ParseRule(tp, payload, target string, params []string, subRules map[string]
22
22
case "GEOSITE" :
23
23
parsed , parseErr = RC .NewGEOSITE (payload , target )
24
24
case "GEOIP" :
25
- noResolve := RC .HasNoResolve (params )
26
- parsed , parseErr = RC .NewGEOIP (payload , target , false , noResolve )
25
+ isSrc , noResolve := RC .ParseParams (params )
26
+ parsed , parseErr = RC .NewGEOIP (payload , target , isSrc , noResolve )
27
27
case "SRC-GEOIP" :
28
28
parsed , parseErr = RC .NewGEOIP (payload , target , true , true )
29
29
case "IP-ASN" :
30
- noResolve := RC .HasNoResolve (params )
31
- parsed , parseErr = RC .NewIPASN (payload , target , false , noResolve )
30
+ isSrc , noResolve := RC .ParseParams (params )
31
+ parsed , parseErr = RC .NewIPASN (payload , target , isSrc , noResolve )
32
32
case "SRC-IP-ASN" :
33
33
parsed , parseErr = RC .NewIPASN (payload , target , true , true )
34
34
case "IP-CIDR" , "IP-CIDR6" :
35
- noResolve := RC .HasNoResolve (params )
36
- parsed , parseErr = RC .NewIPCIDR (payload , target , RC .WithIPCIDRNoResolve (noResolve ))
35
+ isSrc , noResolve := RC .ParseParams (params )
36
+ parsed , parseErr = RC .NewIPCIDR (payload , target , RC .WithIPCIDRSourceIP ( isSrc ), RC . WithIPCIDRNoResolve (noResolve ))
37
37
case "SRC-IP-CIDR" :
38
38
parsed , parseErr = RC .NewIPCIDR (payload , target , RC .WithIPCIDRSourceIP (true ), RC .WithIPCIDRNoResolve (true ))
39
39
case "IP-SUFFIX" :
40
- noResolve := RC .HasNoResolve (params )
41
- parsed , parseErr = RC .NewIPSuffix (payload , target , false , noResolve )
40
+ isSrc , noResolve := RC .ParseParams (params )
41
+ parsed , parseErr = RC .NewIPSuffix (payload , target , isSrc , noResolve )
42
42
case "SRC-IP-SUFFIX" :
43
43
parsed , parseErr = RC .NewIPSuffix (payload , target , true , true )
44
44
case "SRC-PORT" :
@@ -76,11 +76,7 @@ func ParseRule(tp, payload, target string, params []string, subRules map[string]
76
76
case "NOT" :
77
77
parsed , parseErr = logic .NewNOT (payload , target , ParseRule )
78
78
case "RULE-SET" :
79
- noResolve := RC .HasNoResolve (params )
80
- isSrc := RC .HasSrc (params )
81
- if isSrc {
82
- noResolve = true
83
- }
79
+ isSrc , noResolve := RC .ParseParams (params )
84
80
parsed , parseErr = RP .NewRuleSet (payload , target , isSrc , noResolve )
85
81
case "MATCH" :
86
82
parsed = RC .NewMatch (target )
0 commit comments