MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / RemoveRuleByName

Function RemoveRuleByName

internal/toolinjection/injection.go:262–269  ·  view source on GitHub ↗

RemoveRuleByName removes the first rule with the given name from the slice and returns the resulting slice. Used to delete a rule after it fires.

(rules []config.ToolCallInjectionRule, name string)

Source from the content-addressed store, hash-verified

260// RemoveRuleByName removes the first rule with the given name from the slice
261// and returns the resulting slice. Used to delete a rule after it fires.
262func RemoveRuleByName(rules []config.ToolCallInjectionRule, name string) []config.ToolCallInjectionRule {
263 for i, r := range rules {
264 if r.Name == name {
265 return append(rules[:i], rules[i+1:]...)
266 }
267 }
268 return rules
269}
270
271func randomHex(n int) string {
272 b := make([]byte, n)

Callers 1

PrepareInjectionMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected