fix report bug

This commit is contained in:
Yuzuki999
2022-12-23 01:52:44 +08:00
parent a3717c1e63
commit b07c9f0b6b
3 changed files with 24 additions and 11 deletions

View File

@@ -4,7 +4,6 @@ import (
"github.com/goccy/go-json"
"regexp"
"strconv"
"strings"
)
type NodeInfo struct {
@@ -62,12 +61,10 @@ func (c *Client) GetNodeInfo() (nodeInfo *NodeInfo, err error) {
nodeInfo.NodeType = c.NodeType
for i := range nodeInfo.Routes { // parse rules from routes
if nodeInfo.Routes[i].Action == "block" {
for _, v := range strings.Split(nodeInfo.Routes[i].Match, ",") {
nodeInfo.Rules = append(nodeInfo.Rules, DestinationRule{
ID: nodeInfo.Routes[i].Id,
Pattern: regexp.MustCompile(v),
})
}
nodeInfo.Rules = append(nodeInfo.Rules, DestinationRule{
ID: nodeInfo.Routes[i].Id,
Pattern: regexp.MustCompile(nodeInfo.Routes[i].Match),
})
}
}
nodeInfo.Routes = nil