(mgr Controller, keyword string)
| 177 | } |
| 178 | |
| 179 | func loadFromPredefined(mgr Controller, keyword string) string { |
| 180 | predefinedMap := map[string][]string{ |
| 181 | "clam": {"clamav-daemon.service", "clamd@scan.service", "clamd"}, |
| 182 | "freshclam": {"clamav-freshclam.service", "freshclam.service"}, |
| 183 | "fail2ban": {"fail2ban.service", "fail2ban"}, |
| 184 | "supervisor": {"supervisord.service", "supervisor.service", "supervisord", "supervisor"}, |
| 185 | "ssh": {"sshd.service", "ssh.service", "sshd", "ssh"}, |
| 186 | "1panel-core": {"1panel-core.service"}, |
| 187 | "1panel-agent": {"1panel-agent.service"}, |
| 188 | "1panel-ai-proxy": {"1panel-ai-proxy.service"}, |
| 189 | "docker": {"docker.service", "dockerd"}, |
| 190 | "iptables": {"iptables", "iptables-services"}, |
| 191 | } |
| 192 | if val, ok := predefinedMap[keyword]; ok { |
| 193 | for _, item := range val { |
| 194 | if exist, _ := mgr.IsExist(item); exist { |
| 195 | return item |
| 196 | } |
| 197 | } |
| 198 | } |
| 199 | return "" |
| 200 | } |
| 201 | |
| 202 | // GetServicePath returns the configuration file path for the specified service. |
| 203 | // If serviceName is empty, it returns the default directory path based on the system's service manager. |
no test coverage detected