Documentation ¶
Index ¶
- Constants
- func AddSession(sw Session)
- func GetAliveSessions() []string
- func HandleSessionTask(task model.TerminalTask)
- func KillSession(sessionID string) bool
- func RemoveDBSession(sw *DBSwitchSession)
- func RemoveSession(sw *SwitchSession)
- type CmdParser
- type CommandRecorder
- type CommandStorage
- type DBParser
- func (p *DBParser) Close()
- func (p *DBParser) IsCommandForbidden() (string, bool)
- func (p *DBParser) ParseServerOutput(b []byte) []byte
- func (p *DBParser) ParseStream(userInChan, srvInChan <-chan []byte) (userOut, srvOut <-chan []byte)
- func (p *DBParser) ParseUserInput(b []byte) []byte
- func (p *DBParser) SetCMDFilterRules(rules []model.SystemUserFilterRule)
- type DBProxyServer
- type DBSwitchSession
- func (s *DBSwitchSession) Bridge(userConn UserConnection, srvConn srvconn.ServerConnection) (err error)
- func (s *DBSwitchSession) Initial()
- func (s *DBSwitchSession) LoopRead(done chan struct{}, read io.Reader, inChan chan<- []byte)
- func (s *DBSwitchSession) LoopReadFromSrv(done chan struct{}, srvConn srvconn.ServerConnection, inChan chan<- []byte)
- func (s *DBSwitchSession) LoopReadFromUser(done chan struct{}, userConn UserConnection, inChan chan<- []byte)
- func (s *DBSwitchSession) MapData() map[string]interface{}
- func (s *DBSwitchSession) SessionID() string
- func (s *DBSwitchSession) SetFilterRules(cmdRules []model.SystemUserFilterRule)
- func (s *DBSwitchSession) Terminate()
- type Parser
- func (p *Parser) Close()
- func (p *Parser) IsCommandForbidden() (string, bool)
- func (p *Parser) IsInZmodemRecvState() bool
- func (p *Parser) ParseServerOutput(b []byte) []byte
- func (p *Parser) ParseStream(userInChan, srvInChan <-chan []byte) (userOut, srvOut <-chan []byte)
- func (p *Parser) ParseUserInput(b []byte) []byte
- func (p *Parser) SetCMDFilterRules(rules []model.SystemUserFilterRule)
- type ProxyServer
- type ReplayStorage
- type ReplyRecorder
- type Session
- type StorageType
- type SwitchSession
- func (s *SwitchSession) Bridge(userConn UserConnection, srvConn srvconn.ServerConnection) (err error)
- func (s *SwitchSession) Initial()
- func (s *SwitchSession) LoopRead(done chan struct{}, read io.Reader, inChan chan<- []byte)
- func (s *SwitchSession) LoopReadFromSrv(done chan struct{}, srvConn srvconn.ServerConnection, inChan chan<- []byte)
- func (s *SwitchSession) LoopReadFromUser(done chan struct{}, userConn UserConnection, inChan chan<- []byte)
- func (s *SwitchSession) MapData() map[string]interface{}
- func (s *SwitchSession) SessionID() string
- func (s *SwitchSession) SetFilterRules(cmdRules []model.SystemUserFilterRule)
- func (s *SwitchSession) Terminate()
- type UserConnection
Constants ¶
View Source
const ( DBInputParserName = "DB Input parser" DBOutputParserName = "DB Output parser" )
View Source
const ( CommandInputParserName = "Command Input parser" CommandOutputParserName = "Command Output parser" )
Variables ¶
This section is empty.
Functions ¶
func AddSession ¶
func AddSession(sw Session)
func GetAliveSessions ¶
func GetAliveSessions() []string
func HandleSessionTask ¶
func HandleSessionTask(task model.TerminalTask)
func KillSession ¶
func RemoveDBSession ¶
func RemoveDBSession(sw *DBSwitchSession)
func RemoveSession ¶
func RemoveSession(sw *SwitchSession)
Types ¶
type CmdParser ¶
type CmdParser struct {
// contains filtered or unexported fields
}
func NewCmdParser ¶
type CommandRecorder ¶
type CommandRecorder struct {
// contains filtered or unexported fields
}
func NewCommandRecorder ¶
func NewCommandRecorder(sid string) (recorder *CommandRecorder)
func (*CommandRecorder) End ¶
func (c *CommandRecorder) End()
func (*CommandRecorder) Record ¶
func (c *CommandRecorder) Record(command *model.Command)
type CommandStorage ¶
type CommandStorage interface { BulkSave(commands []*model.Command) error StorageType }
func NewCommandStorage ¶
func NewCommandStorage() CommandStorage
type DBParser ¶
type DBParser struct {
// contains filtered or unexported fields
}
func (*DBParser) IsCommandForbidden ¶
IsCommandForbidden 判断命令是不是在过滤规则中
func (*DBParser) ParseServerOutput ¶
ParseServerOutput 解析服务器输出
func (*DBParser) ParseStream ¶
ParseStream 解析数据流
func (*DBParser) ParseUserInput ¶
ParseUserInput 解析用户的输入
func (*DBParser) SetCMDFilterRules ¶
func (p *DBParser) SetCMDFilterRules(rules []model.SystemUserFilterRule)
SetCMDFilterRules 设置命令过滤规则
type DBProxyServer ¶
type DBProxyServer struct { UserConn UserConnection User *model.User Database *model.Database SystemUser *model.SystemUser }
type DBSwitchSession ¶
type DBSwitchSession struct { ID string DateStart string DateEnd string MaxIdleTime time.Duration // contains filtered or unexported fields }
func CreateDBSession ¶
func CreateDBSession(p *DBProxyServer) (sw *DBSwitchSession, err error)
func (*DBSwitchSession) Bridge ¶
func (s *DBSwitchSession) Bridge(userConn UserConnection, srvConn srvconn.ServerConnection) (err error)
Bridge 桥接两个链接
func (*DBSwitchSession) Initial ¶
func (s *DBSwitchSession) Initial()
func (*DBSwitchSession) LoopRead ¶
func (s *DBSwitchSession) LoopRead(done chan struct{}, read io.Reader, inChan chan<- []byte)
func (*DBSwitchSession) LoopReadFromSrv ¶
func (s *DBSwitchSession) LoopReadFromSrv(done chan struct{}, srvConn srvconn.ServerConnection, inChan chan<- []byte)
func (*DBSwitchSession) LoopReadFromUser ¶
func (s *DBSwitchSession) LoopReadFromUser(done chan struct{}, userConn UserConnection, inChan chan<- []byte)
func (*DBSwitchSession) MapData ¶
func (s *DBSwitchSession) MapData() map[string]interface{}
func (*DBSwitchSession) SessionID ¶
func (s *DBSwitchSession) SessionID() string
func (*DBSwitchSession) SetFilterRules ¶
func (s *DBSwitchSession) SetFilterRules(cmdRules []model.SystemUserFilterRule)
func (*DBSwitchSession) Terminate ¶
func (s *DBSwitchSession) Terminate()
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parse 解析用户输入输出, 拦截过滤用户输入输出
func (*Parser) IsCommandForbidden ¶
IsCommandForbidden 判断命令是不是在过滤规则中
func (*Parser) IsInZmodemRecvState ¶
func (*Parser) ParseServerOutput ¶
ParseServerOutput 解析服务器输出
func (*Parser) ParseStream ¶
ParseStream 解析数据流
func (*Parser) ParseUserInput ¶
ParseUserInput 解析用户的输入
func (*Parser) SetCMDFilterRules ¶
func (p *Parser) SetCMDFilterRules(rules []model.SystemUserFilterRule)
SetCMDFilterRules 设置命令过滤规则
type ProxyServer ¶
type ProxyServer struct { UserConn UserConnection User *model.User Asset *model.Asset SystemUser *model.SystemUser // contains filtered or unexported fields }
type ReplayStorage ¶
type ReplayStorage interface { Upload(gZipFile, target string) error StorageType }
func NewReplayStorage ¶
func NewReplayStorage() ReplayStorage
type ReplyRecorder ¶
type ReplyRecorder struct { SessionID string AbsGzFilePath string Target string // contains filtered or unexported fields }
func NewReplyRecord ¶
func NewReplyRecord(sid string) (recorder ReplyRecorder)
func (*ReplyRecorder) End ¶
func (r *ReplyRecorder) End()
func (*ReplyRecorder) Record ¶
func (r *ReplyRecorder) Record(b []byte)
func (*ReplyRecorder) UploadGzipFile ¶
func (r *ReplyRecorder) UploadGzipFile(maxRetry int)
type StorageType ¶
type StorageType interface {
TypeName() string
}
type SwitchSession ¶
type SwitchSession struct { ID string DateStart string DateEnd string MaxIdleTime time.Duration // contains filtered or unexported fields }
func CreateSession ¶
func CreateSession(p *ProxyServer) (sw *SwitchSession, err error)
func NewSwitchSession ¶
func NewSwitchSession(p *ProxyServer) (sw *SwitchSession)
func (*SwitchSession) Bridge ¶
func (s *SwitchSession) Bridge(userConn UserConnection, srvConn srvconn.ServerConnection) (err error)
Bridge 桥接两个链接
func (*SwitchSession) Initial ¶
func (s *SwitchSession) Initial()
func (*SwitchSession) LoopRead ¶
func (s *SwitchSession) LoopRead(done chan struct{}, read io.Reader, inChan chan<- []byte)
func (*SwitchSession) LoopReadFromSrv ¶
func (s *SwitchSession) LoopReadFromSrv(done chan struct{}, srvConn srvconn.ServerConnection, inChan chan<- []byte)
func (*SwitchSession) LoopReadFromUser ¶
func (s *SwitchSession) LoopReadFromUser(done chan struct{}, userConn UserConnection, inChan chan<- []byte)
func (*SwitchSession) MapData ¶
func (s *SwitchSession) MapData() map[string]interface{}
func (*SwitchSession) SessionID ¶
func (s *SwitchSession) SessionID() string
func (*SwitchSession) SetFilterRules ¶
func (s *SwitchSession) SetFilterRules(cmdRules []model.SystemUserFilterRule)
SetFilterRules 设置命令过滤规则
func (*SwitchSession) Terminate ¶
func (s *SwitchSession) Terminate()
Source Files ¶
Click to show internal directories.
Click to hide internal directories.