handler

package
v0.0.0-...-503ec33 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: GPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeAsset selectType = iota + 1
	TypeNodeAsset
	TypeK8s
	TypeDatabase
	TypeHost
)
View Source
const PAGESIZEALL = 0

Variables

This section is empty.

Functions

func ConstructNodeTree

func ConstructNodeTree(assetNodes []model.Node) (treeprint.Tree, []model.Node)

func GetInputUsername

func GetInputUsername(sess io.ReadWriteCloser) (username string, err error)

func GetMatchedAccounts

func GetMatchedAccounts(accounts []model.PermAccount, username string) []model.PermAccount

func IsScpCommand

func IsScpCommand(rawStr string) bool

func NewReaderAt

func NewReaderAt(f *srvconn.SftpFile) io.ReaderAt

func NewWriterAt

func NewWriterAt(f *srvconn.SftpFile, recorder *proxy.FTPFileRecorder) io.WriterAt

func PrettyContent

func PrettyContent(s string) string

Types

type Announcement

type Announcement struct {
	GreenBoldColor string
	ColorEnd       string
	Title          string
	Content        string
}

type ColorMeta

type ColorMeta struct {
	GreenBoldColor string
	ColorEnd       string
}

type DirectHandler

type DirectHandler struct {
	// contains filtered or unexported fields
}

func NewDirectHandler

func NewDirectHandler(sess ssh.Session, jmsService *service.JMService, setters ...DirectOpt) *DirectHandler

func (*DirectHandler) Dispatch

func (d *DirectHandler) Dispatch()

func (*DirectHandler) GetPtyWinSize

func (d *DirectHandler) GetPtyWinSize() (width, height int)

func (*DirectHandler) LoginAsset

func (d *DirectHandler) LoginAsset()

func (*DirectHandler) LoginConnectToken

func (d *DirectHandler) LoginConnectToken(connectToken *model.ConnectToken)

func (*DirectHandler) NewSFTPHandler

func (d *DirectHandler) NewSFTPHandler() *SftpHandler

func (*DirectHandler) Proxy

func (d *DirectHandler) Proxy(asset model.PermAsset)

func (*DirectHandler) WatchWinSizeChange

func (d *DirectHandler) WatchWinSizeChange(winChan <-chan ssh.Window)

type DirectOpt

type DirectOpt func(*directOpt)

func DirectAssets

func DirectAssets(assets []model.PermAsset) DirectOpt

func DirectConnectProtocol

func DirectConnectProtocol(protocol string) DirectOpt

func DirectConnectSftpMode

func DirectConnectSftpMode(sftpMode bool) DirectOpt

func DirectConnectToken

func DirectConnectToken(tokenInfo *model.ConnectToken) DirectOpt

func DirectFormatType

func DirectFormatType(format FormatType) DirectOpt

func DirectTargetAccount

func DirectTargetAccount(username string) DirectOpt

func DirectTerminalConf

func DirectTerminalConf(conf *model.TerminalConfig) DirectOpt

func DirectUser

func DirectUser(User *model.User) DirectOpt

type FormatType

type FormatType int
const (
	FormatNORMAL FormatType = iota
	FormatToken
)

type InteractiveHandler

type InteractiveHandler struct {
	// contains filtered or unexported fields
}

func NewInteractiveHandler

func NewInteractiveHandler(sess ssh.Session, user *model.User, jmsService *service.JMService,
	termConfig model.TerminalConfig) *InteractiveHandler

func (*InteractiveHandler) ChangeLang

func (h *InteractiveHandler) ChangeLang()

func (*InteractiveHandler) Dispatch

func (h *InteractiveHandler) Dispatch()

func (*InteractiveHandler) GetPtySize

func (h *InteractiveHandler) GetPtySize() (int, int)

func (*InteractiveHandler) Initial

func (h *InteractiveHandler) Initial()

func (*InteractiveHandler) WatchWinSizeChange

func (h *InteractiveHandler) WatchWinSizeChange(winChan <-chan ssh.Window)

type LoginReviewHandler

type LoginReviewHandler struct {
	// contains filtered or unexported fields
}

func (*LoginReviewHandler) GetTokenInfo

func (l *LoginReviewHandler) GetTokenInfo() model.ConnectTokenInfo

func (*LoginReviewHandler) WaitReview

func (l *LoginReviewHandler) WaitReview(ctx context.Context) (bool, error)

func (*LoginReviewHandler) WaitTicketReview

func (l *LoginReviewHandler) WaitTicketReview(ctx context.Context, srv *auth.LoginReviewService) (bool, error)
type Menu []MenuItem
type MenuItem struct {
	// contains filtered or unexported fields
}

type Server

type Server struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewServer

func NewServer(termCfg model.TerminalConfig, jmsService *service.JMService) *Server

func (*Server) DirectTCPIPChannelHandler

func (s *Server) DirectTCPIPChannelHandler(ctx ssh.Context, newChan gossh.NewChannel, destAddr string)

func (*Server) GetTerminalConfig

func (s *Server) GetTerminalConfig() model.TerminalConfig

func (*Server) LocalPortForwardingPermission

func (s *Server) LocalPortForwardingPermission(ctx ssh.Context, dstHost string, dstPort uint32) bool

func (*Server) PasswordAuth

func (s *Server) PasswordAuth(ctx ssh.Context, password string) ssh.AuthResult

func (*Server) PublicKeyAuth

func (s *Server) PublicKeyAuth(ctx ssh.Context, key ssh.PublicKey) ssh.AuthResult

func (*Server) SFTPHandler

func (s *Server) SFTPHandler(sess ssh.Session)

func (*Server) SessionHandler

func (s *Server) SessionHandler(sess ssh.Session)

func (*Server) UpdateTerminalConfig

func (s *Server) UpdateTerminalConfig(conf model.TerminalConfig)

type SftpHandler

type SftpHandler struct {
	*srvconn.UserSftpConn
	// contains filtered or unexported fields
}

func NewSFTPHandler

func NewSFTPHandler(jmsService *service.JMService, user *model.User, addr string) *SftpHandler

func (*SftpHandler) Close

func (s *SftpHandler) Close()

func (*SftpHandler) Filecmd

func (s *SftpHandler) Filecmd(r *sftp.Request) (err error)

func (*SftpHandler) Filelist

func (s *SftpHandler) Filelist(r *sftp.Request) (sftp.ListerAt, error)

func (*SftpHandler) Fileread

func (s *SftpHandler) Fileread(r *sftp.Request) (io.ReaderAt, error)

func (*SftpHandler) Filewrite

func (s *SftpHandler) Filewrite(r *sftp.Request) (io.WriterAt, error)

type UserSelectHandler

type UserSelectHandler struct {
	// contains filtered or unexported fields
}

func (*UserSelectHandler) AutoCompletion

func (u *UserSelectHandler) AutoCompletion()

func (UserSelectHandler) CurrentOffSet

func (p UserSelectHandler) CurrentOffSet() int

func (UserSelectHandler) CurrentPage

func (p UserSelectHandler) CurrentPage() int

func (*UserSelectHandler) DisplayCurrentResult

func (u *UserSelectHandler) DisplayCurrentResult()

func (*UserSelectHandler) HasNext

func (u *UserSelectHandler) HasNext() bool

func (*UserSelectHandler) HasPrev

func (u *UserSelectHandler) HasPrev() bool

func (*UserSelectHandler) MoveNextPage

func (u *UserSelectHandler) MoveNextPage()

func (*UserSelectHandler) MovePrePage

func (u *UserSelectHandler) MovePrePage()

func (UserSelectHandler) PageSize

func (p UserSelectHandler) PageSize() int

func (*UserSelectHandler) Proxy

func (u *UserSelectHandler) Proxy(target model.PermAsset)

func (*UserSelectHandler) Retrieve

func (u *UserSelectHandler) Retrieve(pageSize, offset int, searches ...string) []model.PermAsset

func (*UserSelectHandler) Search

func (u *UserSelectHandler) Search(key string)

func (*UserSelectHandler) SearchAgain

func (u *UserSelectHandler) SearchAgain(key string)

func (*UserSelectHandler) SearchOrProxy

func (u *UserSelectHandler) SearchOrProxy(key string)

func (*UserSelectHandler) SetAllLocalData

func (u *UserSelectHandler) SetAllLocalData(data []model.PermAsset)

func (*UserSelectHandler) SetLoadPolicy

func (u *UserSelectHandler) SetLoadPolicy(policy dataSource)

func (*UserSelectHandler) SetNode

func (u *UserSelectHandler) SetNode(node model.Node)

func (*UserSelectHandler) SetSelectType

func (u *UserSelectHandler) SetSelectType(s selectType)

func (UserSelectHandler) TotalCount

func (p UserSelectHandler) TotalCount() int

func (UserSelectHandler) TotalPage

func (p UserSelectHandler) TotalPage() int

type WrapperSession

type WrapperSession struct {
	Uuid string
	Sess ssh.Session
	// contains filtered or unexported fields
}

func NewWrapperSession

func NewWrapperSession(sess ssh.Session) *WrapperSession

func (*WrapperSession) Close

func (w *WrapperSession) Close() error

func (*WrapperSession) Context

func (w *WrapperSession) Context() context.Context

func (*WrapperSession) HandleRoomEvent

func (w *WrapperSession) HandleRoomEvent(event string, msg *exchange.RoomMessage)

func (*WrapperSession) ID

func (w *WrapperSession) ID() string

func (*WrapperSession) LoginFrom

func (w *WrapperSession) LoginFrom() string

func (*WrapperSession) Pty

func (w *WrapperSession) Pty() ssh.Pty

func (*WrapperSession) Read

func (w *WrapperSession) Read(p []byte) (int, error)

func (*WrapperSession) RemoteAddr

func (w *WrapperSession) RemoteAddr() string

func (*WrapperSession) SetWin

func (w *WrapperSession) SetWin(win ssh.Window)

func (*WrapperSession) WinCh

func (w *WrapperSession) WinCh() (winch <-chan ssh.Window)

func (*WrapperSession) Write

func (w *WrapperSession) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL