MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / loadSSHSocketNames

Function loadSSHSocketNames

agent/app/service/ssh.go:182–205  ·  view source on GitHub ↗
(serviceName string)

Source from the content-addressed store, hash-verified

180}
181
182func loadSSHSocketNames(serviceName string) []string {
183 baseName := strings.TrimSuffix(serviceName, ".service")
184 candidates := []string{baseName + ".socket"}
185 switch baseName {
186 case "ssh":
187 candidates = append(candidates, "sshd.socket")
188 case "sshd":
189 candidates = append(candidates, "ssh.socket")
190 }
191
192 seen := map[string]struct{}{}
193 var sockets []string
194 for _, candidate := range candidates {
195 if _, ok := seen[candidate]; ok {
196 continue
197 }
198 seen[candidate] = struct{}{}
199 exist, _ := controller.CheckExist(candidate)
200 if exist {
201 sockets = append(sockets, candidate)
202 }
203 }
204 return sockets
205}
206
207func (u *SSHService) Update(req dto.SSHUpdate) error {
208 serviceName, err := loadServiceName()

Callers 4

stopSSHSocketIfActiveFunction · 0.85
disableSSHSocketFunction · 0.85
hasActiveSSHSocketFunction · 0.85
hasEnabledSSHSocketFunction · 0.85

Calls 1

CheckExistMethod · 0.65

Tested by

no test coverage detected