MCPcopy
hub / github.com/gdy666/lucky / EnableReverseProxyRuleByKey

Function EnableReverseProxyRuleByKey

module/reverseproxy/reverseproxy.go:123–140  ·  view source on GitHub ↗
(ruleKey string, enable bool)

Source from the content-addressed store, hash-verified

121}
122
123func EnableReverseProxyRuleByKey(ruleKey string, enable bool) error {
124 config.ConfigureMutex.Lock()
125 defer config.ConfigureMutex.Unlock()
126 ruleIndex := -1
127
128 for i := range config.Configure.ReverseProxyRuleList {
129 if config.Configure.ReverseProxyRuleList[i].RuleKey == ruleKey {
130 ruleIndex = i
131 break
132 }
133 }
134 if ruleIndex == -1 {
135 return fmt.Errorf("开关反向代理规则失败,ruleKey %s 未找到", ruleKey)
136 }
137 config.Configure.ReverseProxyRuleList[ruleIndex].Enable = enable
138
139 return config.Save()
140}
141
142func EnableReverseProxySubRule(ruleKey, proxyKey string, enable bool) error {
143 config.ConfigureMutex.Lock()

Callers 1

EnableRuleByKeyFunction · 0.70

Calls 1

SaveFunction · 0.92

Tested by

no test coverage detected