(ruleKey string, enable bool)
| 121 | } |
| 122 | |
| 123 | func 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 | |
| 142 | func EnableReverseProxySubRule(ruleKey, proxyKey string, enable bool) error { |
| 143 | config.ConfigureMutex.Lock() |
no test coverage detected