Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
devhaozi committed Jul 25, 2023
1 parent cc70ab1 commit 5ec6a88
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions app/http/controllers/ssh_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,24 +112,22 @@ func (r *SshController) Session(ctx http.Context) {
}
defer ws.Close()

var config *ssh.SSHClientConfig
config = ssh.SSHClientConfigPassword(
config := ssh.SSHClientConfigPassword(
r.setting.Get(models.SettingKeySshHost)+":"+r.setting.Get(models.SettingKeySshPort),
r.setting.Get(models.SettingKeySshUser),
r.setting.Get(models.SettingKeySshPassword),
)

client, err := ssh.NewSSHClient(config)
if err != nil {
ws.WriteControl(websocket.CloseMessage,
_ = ws.WriteControl(websocket.CloseMessage,
[]byte(err.Error()), time.Now().Add(time.Second))
return
}
defer client.Close()

turn, err := ssh.NewTurn(ws, client)
if err != nil {
ws.WriteControl(websocket.CloseMessage,
_ = ws.WriteControl(websocket.CloseMessage,
[]byte(err.Error()), time.Now().Add(time.Second))
return
}
Expand Down

0 comments on commit 5ec6a88

Please sign in to comment.