proxy

package
v0.0.0-...-ec5e93e Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnMatchProtocol = errors.New("the protocols are not matched")
	ErrPermission      = errors.New("no permission")
	ErrNoAuthInfo      = errors.New("no auth info")
	ErrInvalidPort     = errors.New("invalid port")
)

Functions

func AddCommonSwitch

func AddCommonSwitch(s *SwitchSession)

func GetAliveSessions

func GetAliveSessions() []string

func RemoveCommonSwitch

func RemoveCommonSwitch(s *SwitchSession)

Types

type ConnectionOption

type ConnectionOption func(options *ConnectionOptions)

func ConnectAsset

func ConnectAsset(asset *model.Asset) ConnectionOption

func ConnectSystemUser

func ConnectSystemUser(systemUser *model.SystemUser) ConnectionOption

func ConnectUser

func ConnectUser(user *model.User) ConnectionOption

type ConnectionOptions

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

func (*ConnectionOptions) ConnectMsg

func (opts *ConnectionOptions) ConnectMsg() string

func (*ConnectionOptions) TerminalTitle

func (opts *ConnectionOptions) TerminalTitle() string

type ReplyInfo

type ReplyInfo struct {
	Width     int
	Height    int
	TimeStamp time.Time
}

type ReplyRecorder

type ReplyRecorder struct {
	SessionID string

	Target string
	Writer *common.AsciiWriter
	// contains filtered or unexported fields
}

func NewReplayRecord

func NewReplayRecord(sid, user, asset string, info *ReplyInfo) (*ReplyRecorder, error)

func (*ReplyRecorder) End

func (r *ReplyRecorder) End()

func (*ReplyRecorder) Record

func (r *ReplyRecorder) Record(p []byte)

type Server

type Server struct {
	ID       string
	UserConn UserConnection

	CreateSessionCallback    func() error
	ConnectedSuccessCallback func() error
	ConnectedFailedCallback  func(err error) error
	DisConnectedCallback     func() error
	// contains filtered or unexported fields
}

func NewServer

func NewServer(conn UserConnection, core *core.Core, opts ...ConnectionOption) (*Server, error)

func (*Server) CheckPermissionExpired

func (s *Server) CheckPermissionExpired(now time.Time) bool

func (*Server) ConvertErrorToReadableMsg

func (s *Server) ConvertErrorToReadableMsg(e error) string

func (*Server) GetReplayRecorder

func (s *Server) GetReplayRecorder() *ReplyRecorder

func (*Server) IsKeyboardMode

func (s *Server) IsKeyboardMode() bool

func (*Server) Proxy

func (s *Server) Proxy()

type SwitchSession

type SwitchSession struct {
	ID string

	MaxIdleTime int
	// contains filtered or unexported fields
}

func GetSessionById

func GetSessionById(id string) (s *SwitchSession, ok bool)

func (*SwitchSession) Bridge

func (s *SwitchSession) Bridge(userConn UserConnection, srvConn srvconn.ServerConnection) (err error)

Bridge 桥接两个链接

func (*SwitchSession) SessionID

func (s *SwitchSession) SessionID() string

func (*SwitchSession) Terminate

func (s *SwitchSession) Terminate(username string)

type UserConnection

type UserConnection interface {
	io.ReadWriteCloser
	ID() string
	WinCh() <-chan ssh.Window
	LoginFrom() string
	RemoteAddr() string
	Pty() ssh.Pty
	Context() context.Context
}

Jump to

Keyboard shortcuts

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