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

Method Update

agent/app/service/ssh.go:207–226  ·  view source on GitHub ↗
(req dto.SSHUpdate)

Source from the content-addressed store, hash-verified

205}
206
207func (u *SSHService) Update(req dto.SSHUpdate) error {
208 serviceName, err := loadServiceName()
209 if err != nil {
210 return err
211 }
212
213 directives, _, err := parseSSHConfigTree(sshPath)
214 if err != nil {
215 return err
216 }
217 oldPortValue := strings.Join(loadSSHPortValues(directives), ",")
218 if err := updateSSHDirectiveValue(req.Key, req.NewValue, directives); err != nil {
219 return err
220 }
221 if req.Key == "Port" {
222 handleSSHPortUpdate(oldPortValue, req.NewValue)
223 }
224
225 return restartSSHService(serviceName)
226}
227
228func loadSSHServiceStatus(data *dto.SSHInfo) {
229 serviceName, err := loadServiceName()

Callers

nothing calls this directly

Calls 6

loadServiceNameFunction · 0.85
parseSSHConfigTreeFunction · 0.85
loadSSHPortValuesFunction · 0.85
updateSSHDirectiveValueFunction · 0.85
handleSSHPortUpdateFunction · 0.85
restartSSHServiceFunction · 0.85

Tested by

no test coverage detected