@@ -114,23 +114,25 @@ func GetCustomConfig(infos []*panel.NodeInfo) (*dns.Config, []*core.OutboundHand
114114 continue
115115 }
116116 coreRouterConfig .RuleList = append (coreRouterConfig .RuleList , rawRule )
117- case "route" :
118- if route .ActionValue == nil {
119- continue
117+ case "block_protocol" :
118+ rule := map [string ]interface {}{
119+ "protocol" : route .Match ,
120+ "outboundTag" : "block" ,
120121 }
121- outbound := & coreConf.OutboundDetourConfig {}
122- err := json .Unmarshal ([]byte (* route .ActionValue ), outbound )
122+ rawRule , err := json .Marshal (rule )
123123 if err != nil {
124124 continue
125125 }
126- if hasOutboundWithTag (coreOutboundConfig , outbound .Tag ) {
126+ coreRouterConfig .RuleList = append (coreRouterConfig .RuleList , rawRule )
127+ case "route" :
128+ if route .ActionValue == nil {
127129 continue
128130 }
129- custom_outbound , err := outbound .Build ()
131+ outbound := & coreConf.OutboundDetourConfig {}
132+ err := json .Unmarshal ([]byte (* route .ActionValue ), outbound )
130133 if err != nil {
131134 continue
132135 }
133- coreOutboundConfig = append (coreOutboundConfig , custom_outbound )
134136 rule := map [string ]interface {}{
135137 "domain" : route .Match ,
136138 "outboundTag" : outbound .Tag ,
@@ -140,23 +142,23 @@ func GetCustomConfig(infos []*panel.NodeInfo) (*dns.Config, []*core.OutboundHand
140142 continue
141143 }
142144 coreRouterConfig .RuleList = append (coreRouterConfig .RuleList , rawRule )
143- case "route_ip" :
144- if route .ActionValue == nil {
145+ if hasOutboundWithTag (coreOutboundConfig , outbound .Tag ) {
145146 continue
146147 }
147- outbound := & coreConf.OutboundDetourConfig {}
148- err := json .Unmarshal ([]byte (* route .ActionValue ), outbound )
148+ custom_outbound , err := outbound .Build ()
149149 if err != nil {
150150 continue
151151 }
152- if hasOutboundWithTag (coreOutboundConfig , outbound .Tag ) {
152+ coreOutboundConfig = append (coreOutboundConfig , custom_outbound )
153+ case "route_ip" :
154+ if route .ActionValue == nil {
153155 continue
154156 }
155- custom_outbound , err := outbound .Build ()
157+ outbound := & coreConf.OutboundDetourConfig {}
158+ err := json .Unmarshal ([]byte (* route .ActionValue ), outbound )
156159 if err != nil {
157160 continue
158161 }
159- coreOutboundConfig = append (coreOutboundConfig , custom_outbound )
160162 rule := map [string ]interface {}{
161163 "ip" : route .Match ,
162164 "outboundTag" : outbound .Tag ,
@@ -166,6 +168,14 @@ func GetCustomConfig(infos []*panel.NodeInfo) (*dns.Config, []*core.OutboundHand
166168 continue
167169 }
168170 coreRouterConfig .RuleList = append (coreRouterConfig .RuleList , rawRule )
171+ if hasOutboundWithTag (coreOutboundConfig , outbound .Tag ) {
172+ continue
173+ }
174+ custom_outbound , err := outbound .Build ()
175+ if err != nil {
176+ continue
177+ }
178+ coreOutboundConfig = append (coreOutboundConfig , custom_outbound )
169179 case "default_out" :
170180 if route .ActionValue == nil {
171181 continue
0 commit comments