Merge remote-tracking branch 'origin/main' into multi-tenant
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# 项目信息
|
||||
framework:
|
||||
name: "CN EMS"
|
||||
version: "2.2407.5"
|
||||
name: "OMC"
|
||||
version: "2.2408.2"
|
||||
|
||||
# 应用服务配置
|
||||
server:
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# 应用服务配置
|
||||
server:
|
||||
port: 3040
|
||||
port: 33040
|
||||
proxy: true
|
||||
|
||||
# 日志
|
||||
logger:
|
||||
fileDir: "C:/usr/local/omc/log"
|
||||
fileDir: "C:/var/log"
|
||||
level: 0 # 输出最低等级
|
||||
|
||||
# 静态文件配置, 相对项目根路径或填绝对路径
|
||||
@@ -28,11 +28,11 @@ gorm:
|
||||
dataSource:
|
||||
default:
|
||||
type: "mysql"
|
||||
host: "192.168.0.229"
|
||||
host: "127.0.0.1"
|
||||
port: 33066
|
||||
username: "root"
|
||||
password: "1000omc@kp!"
|
||||
database: "omc_db_dev"
|
||||
database: "omc_db"
|
||||
logging: true
|
||||
|
||||
# Redis 缓存数据,数据源声明全小写
|
||||
@@ -41,14 +41,14 @@ redis:
|
||||
# OMC系统使用库
|
||||
default:
|
||||
port: 6379 # Redis port
|
||||
host: "192.168.0.229" # Redis host
|
||||
password: ""
|
||||
host: "127.0.0.1" # Redis host
|
||||
password: "helloearth"
|
||||
db: 10 # Redis db_num
|
||||
# UDM网元用户库
|
||||
udmuser:
|
||||
port: 6379 # Redis port
|
||||
host: "192.168.0.229"
|
||||
password: ""
|
||||
host: "127.0.0.1"
|
||||
password: "helloearth"
|
||||
db: 0 # Redis db_num
|
||||
# 多个数据源时可以用这个指定默认的数据源
|
||||
defaultDataSourceName: "default"
|
||||
|
||||
@@ -50,10 +50,12 @@ func (c *ConnTelnet) NewClient() (*ConnTelnet, error) {
|
||||
// fmt.Fprintln(client, c.User)
|
||||
// fmt.Fprintln(client, c.Password)
|
||||
|
||||
c.Client = &client
|
||||
|
||||
// 调整窗口大小 (120 列 x 128 行)
|
||||
requestPty(c.Client, 120, 128)
|
||||
// 需要确保接收方理解并正确处理发送窗口大小设置命令
|
||||
client.Write([]byte{255, 251, 31})
|
||||
client.Write([]byte{255, 250, 31, byte(120 >> 8), byte(120 & 0xFF), byte(128 >> 8), byte(128 & 0xFF), 255, 240})
|
||||
|
||||
c.Client = &client
|
||||
|
||||
// 排空连接登录的信息
|
||||
c.RunCMD("")
|
||||
@@ -111,20 +113,9 @@ func (c *ConnTelnet) NewClientSession(cols, rows int) (*TelnetClientSession, err
|
||||
if c.Client == nil {
|
||||
return nil, fmt.Errorf("telnet client not connected")
|
||||
}
|
||||
requestPty(c.Client, cols, rows)
|
||||
return &TelnetClientSession{
|
||||
s := &TelnetClientSession{
|
||||
Client: *c.Client,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// requestPty 调整终端窗口大小
|
||||
func requestPty(client *net.Conn, cols, rows int) error {
|
||||
if client == nil {
|
||||
return fmt.Errorf("telnet client not connected")
|
||||
}
|
||||
conn := *client
|
||||
// 需要确保接收方理解并正确处理发送窗口大小设置命令
|
||||
conn.Write([]byte{255, 251, 31})
|
||||
conn.Write([]byte{255, 250, 31, byte(cols >> 8), byte(cols & 0xFF), byte(rows >> 8), byte(rows & 0xFF), 255, 240})
|
||||
return nil
|
||||
s.WindowChange(cols, rows)
|
||||
return s, nil
|
||||
}
|
||||
|
||||
@@ -19,6 +19,17 @@ func (s *TelnetClientSession) Close() {
|
||||
}
|
||||
}
|
||||
|
||||
// WindowChange informs the remote host about a terminal window dimension change to h rows and w columns.
|
||||
func (s *TelnetClientSession) WindowChange(h, w int) error {
|
||||
if s.Client == nil {
|
||||
return fmt.Errorf("client is nil to content write failed")
|
||||
}
|
||||
// 需要确保接收方理解并正确处理发送窗口大小设置命令
|
||||
s.Client.Write([]byte{255, 251, 31})
|
||||
s.Client.Write([]byte{255, 250, 31, byte(w >> 8), byte(w & 0xFF), byte(h >> 8), byte(h & 0xFF), 255, 240})
|
||||
return nil
|
||||
}
|
||||
|
||||
// Write 写入命令 不带回车(\n)也会执行根据客户端情况
|
||||
func (s *TelnetClientSession) Write(cmd string) (int, error) {
|
||||
if s.Client == nil {
|
||||
|
||||
Reference in New Issue
Block a user