feat: add readable routing rule comments

This commit is contained in:
Zeusina committed 2026-09-28 17:33:07 +03:00
1 parent 2206d03b39
commit 2fcb4ae171
4 files changed
+25

No files matched your search

+6
View File
@@ -38,6 +38,7 @@ type Server struct {
type Rule struct {
Name string `yaml:"name"`
Comment string `yaml:"comment"`
Disabled bool `yaml:"disabled"`
Match map[string]any `yaml:"match"`
Outbound Outbound `yaml:"outbound"`
@@ -335,7 +336,12 @@ func reconcileWithOutbounds(config map[string]any, desired []Rule, position stri
delete(item, "outboundTag")
delete(item, "balancerTag")
delete(item, "ruleTag")
delete(item, "comment")
item["ruleTag"] = managedPrefix + rule.Name
item["comment"] = rule.Comment
if rule.Comment == "" {
item["comment"] = rule.Name
}
item["enabled"] = !rule.Disabled
if len(matches) == 1 {
item["outboundTag"] = matches[0]