fix: telnet调整窗口大小
This commit is contained in:
@@ -257,18 +257,18 @@ func (s *WSController) Telnet(c *gin.Context) {
|
||||
defer client.Close()
|
||||
|
||||
// 终端单行字符数
|
||||
cols, err := strconv.Atoi(c.Query("cols"))
|
||||
if err != nil || cols > 254 {
|
||||
cols, err := strconv.Atoi(c.DefaultQuery("cols", "120"))
|
||||
if err != nil {
|
||||
cols = 120
|
||||
}
|
||||
// 终端显示行数
|
||||
rows, err := strconv.Atoi(c.Query("rows"))
|
||||
if err != nil || cols > rows {
|
||||
rows, err := strconv.Atoi(c.DefaultQuery("rows", "128"))
|
||||
if err != nil {
|
||||
rows = 128
|
||||
}
|
||||
|
||||
// 创建Telnet客户端会话
|
||||
clientSession, err := client.NewClientSession(uint8(cols), uint8(rows))
|
||||
clientSession, err := client.NewClientSession(cols, rows)
|
||||
if err != nil {
|
||||
// 连接主机失败,请检查连接参数后重试
|
||||
c.JSON(200, result.ErrMsg(i18n.TKey(language, "neHost.errByHostInfo")))
|
||||
|
||||
Reference in New Issue
Block a user