fix: Telnet支持调整发送窗口大小

This commit is contained in:
TsMask
2024-04-16 19:51:23 +08:00
parent b050643714
commit 325baed56e
2 changed files with 17 additions and 2 deletions

View File

@@ -256,8 +256,19 @@ func (s *WSController) Telnet(c *gin.Context) {
}
defer client.Close()
// 终端单行字符数
cols, err := strconv.Atoi(c.Query("cols"))
if err != nil || cols > 254 {
cols = 80
}
// 终端显示行数
rows, err := strconv.Atoi(c.Query("rows"))
if err != nil || cols > rows {
rows = 40
}
// 创建Telnet客户端会话
clientSession, err := client.NewClientSession()
clientSession, err := client.NewClientSession(uint8(cols), uint8(rows))
if err != nil {
// 连接主机失败,请检查连接参数后重试
c.JSON(200, result.ErrMsg(i18n.TKey(language, "neHost.errByHostInfo")))