fix ssh connect bug on h3c switchs

This commit is contained in:
Feng_Qi 2017-12-28 16:43:33 +08:00
parent 2fcf4256d8
commit 016cb92489
2 changed files with 20 additions and 10 deletions

View file

@ -50,6 +50,15 @@ func connect(user, password, host string, port int) (*ssh.Session, error) {
if session, err = client.NewSession(); err != nil {
return nil, err
}
modes := ssh.TerminalModes{
ssh.ECHO: 0, // disable echoing
ssh.TTY_OP_ISPEED: 14400, // input speed = 14.4kbaud
ssh.TTY_OP_OSPEED: 14400, // output speed = 14.4kbaud
}
if err := session.RequestPty("xterm", 80, 40, modes); err != nil {
return nil, err
}
return session, nil
}