File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed
Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -248,19 +248,17 @@ func (c *APIClient) ReportUserTraffic(userTraffic *[]api.UserTraffic) error {
248248// GetNodeRule implements the API interface
249249func (c * APIClient ) GetNodeRule () (* []api.DetectRule , error ) {
250250 ruleList := c .LocalRuleList
251- if c .NodeType != "V2ray" {
252- return & ruleList , nil
253- }
254251
255- // V2board only support the rule for v2ray
256- nodeInfoResponse := c .resp .Load ().(* simplejson.Json ) // todo waiting v2board send configuration
257- for i , rule := range nodeInfoResponse .Get ("rules" ).MustStringArray () {
258- rule = strings .TrimPrefix (rule , "regexp:" )
259- ruleListItem := api.DetectRule {
260- ID : i ,
261- Pattern : regexp .MustCompile (rule ),
252+ nodeInfoResponse := c .resp .Load ().(* simplejson.Json )
253+ for i , rule := range nodeInfoResponse .Get ("routes" ).MustArray () {
254+ r := rule .(map [string ]any )
255+ if r ["action" ] == "block" {
256+ ruleListItem := api.DetectRule {
257+ ID : i ,
258+ Pattern : regexp .MustCompile (r ["match" ].(string )),
259+ }
260+ ruleList = append (ruleList , ruleListItem )
262261 }
263- ruleList = append (ruleList , ruleListItem )
264262 }
265263
266264 return & ruleList , nil
You can’t perform that action at this time.
0 commit comments