Commit 9aa34a44 authored by Eric's avatar Eric

[Update] fix panic err

parent 778af195
...@@ -60,6 +60,8 @@ func (p *Parser) Initial() { ...@@ -60,6 +60,8 @@ func (p *Parser) Initial() {
p.cmdOutputParser = &CmdParser{} p.cmdOutputParser = &CmdParser{}
p.cmdInputParser.Initial() p.cmdInputParser.Initial()
p.cmdOutputParser.Initial() p.cmdOutputParser.Initial()
record := NewCommandRecorder(p.session)
p.SetCommandRecorder(record)
} }
// Todo: parseMultipleInput 依然存在问题 // Todo: parseMultipleInput 依然存在问题
......
...@@ -13,6 +13,7 @@ import ( ...@@ -13,6 +13,7 @@ import (
"cocogo/pkg/logger" "cocogo/pkg/logger"
"cocogo/pkg/model" "cocogo/pkg/model"
"cocogo/pkg/service" "cocogo/pkg/service"
"strconv"
) )
type ProxyServer struct { type ProxyServer struct {
...@@ -46,10 +47,10 @@ func (p *ProxyServer) validatePermission() bool { ...@@ -46,10 +47,10 @@ func (p *ProxyServer) validatePermission() bool {
func (p *ProxyServer) getServerConn() (srvConn ServerConnection, err error) { func (p *ProxyServer) getServerConn() (srvConn ServerConnection, err error) {
srvConn = &ServerSSHConnection{ srvConn = &ServerSSHConnection{
host: "192.168.244.185", host: p.Asset.Ip,
port: "22", port: strconv.Itoa(p.Asset.Port),
user: "web", user: p.SystemUser.UserName,
password: "redhat", password: p.SystemUser.Password,
timeout: config.Conf.SSHTimeout, timeout: config.Conf.SSHTimeout,
} }
pty, _, ok := p.Session.Pty() pty, _, ok := p.Session.Pty()
......
...@@ -5,7 +5,7 @@ import ( ...@@ -5,7 +5,7 @@ import (
"time" "time"
"github.com/gliderlabs/ssh" "github.com/gliderlabs/ssh"
"github.com/satori/go.uuid" uuid "github.com/satori/go.uuid"
"cocogo/pkg/logger" "cocogo/pkg/logger"
) )
...@@ -14,6 +14,7 @@ func NewSwitch(userConn UserConnection, serverConn ServerConnection) (sw *Sessio ...@@ -14,6 +14,7 @@ func NewSwitch(userConn UserConnection, serverConn ServerConnection) (sw *Sessio
parser := new(Parser) parser := new(Parser)
parser.Initial() parser.Initial()
sw = &Session{userConn: userConn, serverConn: serverConn, parser: parser} sw = &Session{userConn: userConn, serverConn: serverConn, parser: parser}
parser.session = sw
return 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