Commit 9aa34a44 authored by Eric's avatar Eric

[Update] fix panic err

parent 778af195
......@@ -60,6 +60,8 @@ func (p *Parser) Initial() {
p.cmdOutputParser = &CmdParser{}
p.cmdInputParser.Initial()
p.cmdOutputParser.Initial()
record := NewCommandRecorder(p.session)
p.SetCommandRecorder(record)
}
// Todo: parseMultipleInput 依然存在问题
......
......@@ -13,6 +13,7 @@ import (
"cocogo/pkg/logger"
"cocogo/pkg/model"
"cocogo/pkg/service"
"strconv"
)
type ProxyServer struct {
......@@ -46,10 +47,10 @@ func (p *ProxyServer) validatePermission() bool {
func (p *ProxyServer) getServerConn() (srvConn ServerConnection, err error) {
srvConn = &ServerSSHConnection{
host: "192.168.244.185",
port: "22",
user: "web",
password: "redhat",
host: p.Asset.Ip,
port: strconv.Itoa(p.Asset.Port),
user: p.SystemUser.UserName,
password: p.SystemUser.Password,
timeout: config.Conf.SSHTimeout,
}
pty, _, ok := p.Session.Pty()
......
......@@ -5,7 +5,7 @@ import (
"time"
"github.com/gliderlabs/ssh"
"github.com/satori/go.uuid"
uuid "github.com/satori/go.uuid"
"cocogo/pkg/logger"
)
......@@ -14,6 +14,7 @@ func NewSwitch(userConn UserConnection, serverConn ServerConnection) (sw *Sessio
parser := new(Parser)
parser.Initial()
sw = &Session{userConn: userConn, serverConn: serverConn, parser: parser}
parser.session = sw
return sw
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment