srvconn

package
v0.0.0-...-4e200cf Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: GPL-3.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtocolSSH    = "ssh"
	ProtocolSFTP   = "sftp"
	ProtocolTELNET = "telnet"
	ProtocolK8s    = "k8s"

	ProtocolRedis      = "redis"
	ProtocolMongoDB    = "mongodb"
	ProtocolClickHouse = "clickhouse"

	ProtocolMySQL      = "mysql"
	ProtocolMariadb    = "mariadb"
	ProtocolSQLServer  = "sqlserver"
	ProtocolPostgresql = "postgresql"
	ProtocolOracle     = "oracle"
)
View Source
const (
	CharCleanLine = '\x15'
	CharCTRLE     = '\x05'
)
View Source
const (
	LinuxSuCommand = "su - %s; exit"

	LinuxSudoCommand = "sudo su - %s; exit"

	LinuxOnlySuCommand = "su %s; exit"

	LinuxOnlySudoCommand = "sudo su %s; exit"

	SuCommandEnable = "enable"

	SuCommandSuper = "super 15"

	SuCommandSuperH3C = "super level-15"
)
View Source
const (
	StatusUnMatch matchStatus = 1
	StatusMatch   matchStatus = 2
	StatusSuccess matchStatus = 3
	StatusFailed  matchStatus = 4
)
View Source
const (
	FilenamePolicyReplace = "replace"
	FilenamePolicySuffix  = "suffix"
)
View Source
const (
	SFTPPathSeparator = "/"
)
View Source
const (
	SearchFolderName = "_Search"
)

Variables

View Source
var (
	ErrUnSupportedProtocol = errors.New("unsupported protocol")

	ErrKubectlClient = ErrNoClient{"Kubectl"}

	ErrRedisClient   = ErrNoClient{"Redis"}
	ErrMongoDBClient = ErrNoClient{"MongoDB"}
)
View Source
var (
	ErrNotFoundCommand = errors.New("not found command")

	ErrNotFoundShell = errors.New("not found any shell")
)
View Source
var (
	ErrNoAvailable = errors.New("no available gateway")
	ErrGatewayDial = errors.New("gateway dial addr failed")
	ErrSSHClient   = errors.New("new ssh client failed")
)
View Source
var ErrorTimeout = errors.New("i/o timeout")
View Source
var (
	InValidToken = errors.New("invalid token")
)

Functions

func AddClientCache

func AddClientCache(key string, client *SSHClient)

func BuildMongoDBURI

func BuildMongoDBURI(opts ...MongoOpt) string

func BuildNobodyWithOpts

func BuildNobodyWithOpts(opts ...localcommand.Option) (nobodyOpts []localcommand.Option, err error)

func ClearTempFileDelay

func ClearTempFileDelay(sleepTime time.Duration, filepath ...string)

func DoLogin

func DoLogin(opt *sqlOption, lcmd *localcommand.LocalCommand, dbType string) (*localcommand.LocalCommand, error)

func FindAvailableShell

func FindAvailableShell(opt *ContainerOptions) (shell string, err error)

func HasShellInContainer

func HasShellInContainer(opt *ContainerOptions, shell string) error

func IsExistPath

func IsExistPath(client *sftp.Client, path string) bool

func IsSupportedProtocol

func IsSupportedProtocol(p string) error

func IsValidK8sUserToken

func IsValidK8sUserToken(o *k8sOptions) bool

func LoginToSSHSu

func LoginToSSHSu(sc *SSHConnection) error

func LoginToTelnetSu

func LoginToTelnetSu(sc *TelnetConnection) error

func MakeReuseSSHClientKey

func MakeReuseSSHClientKey(userId, assetId, account,
	ip, username string) string

func MatchLoginPrefix

func MatchLoginPrefix(prefix string, dbType string, lcmd *localcommand.LocalCommand) (*localcommand.LocalCommand, error)

func NewCustomTransport

func NewCustomTransport(options ...TransportOption) *http.Transport

func NewOpenAIClient

func NewOpenAIClient(authToken, baseURL, proxy string) *openai.Client

func NewSftpConn

func NewSftpConn(sess *gossh.Session) (*sftp.Client, error)

func NewSftpFileInfo

func NewSftpFileInfo(info os.FileInfo, isRoot bool) os.FileInfo

func ReleaseClientCacheKey

func ReleaseClientCacheKey(key string, client *SSHClient)

func StoreCAFileToLocal

func StoreCAFileToLocal(caCert string) (string, error)

func StorePrivateKeyFileToLocal

func StorePrivateKeyFileToLocal(caCert string) (string, error)

func SupportedDBProtocols

func SupportedDBProtocols() []string

func SupportedHostProtocols

func SupportedHostProtocols() []string

func SupportedProtocols

func SupportedProtocols() []string

Types

type AssetDir

type AssetDir struct {
	ShowHidden bool
	// contains filtered or unexported fields
}

func NewAssetDir

func NewAssetDir(jmsService *service.JMService, user *model.User, opts ...FolderBuilderOption) *AssetDir

func (*AssetDir) Create

func (ad *AssetDir) Create(path string) (*SftpFile, error)

func (*AssetDir) CreateFTPLog

func (ad *AssetDir) CreateFTPLog(su *model.PermAccount, operate, filename string, isSuccess bool) *model.FTPLog

func (*AssetDir) GetSFTPAndRealPath

func (ad *AssetDir) GetSFTPAndRealPath(su *model.PermAccount, path string) (conn *SftpConn, realPath string)

func (*AssetDir) GetSftpClient

func (ad *AssetDir) GetSftpClient(su *model.PermAccount) (conn *SftpConn, err error)

func (*AssetDir) IsDir

func (ad *AssetDir) IsDir() bool

func (*AssetDir) IsUniqueSu

func (ad *AssetDir) IsUniqueSu() (folderName string, ok bool)

func (*AssetDir) MkdirAll

func (ad *AssetDir) MkdirAll(path string) (err error)

func (*AssetDir) ModTime

func (ad *AssetDir) ModTime() time.Time

func (*AssetDir) Mode

func (ad *AssetDir) Mode() os.FileMode

func (*AssetDir) Name

func (ad *AssetDir) Name() string

func (*AssetDir) Open

func (ad *AssetDir) Open(path string) (*SftpFile, error)

func (*AssetDir) ReadDir

func (ad *AssetDir) ReadDir(path string) (res []os.FileInfo, err error)
func (ad *AssetDir) ReadLink(path string) (res string, err error)

func (*AssetDir) Remove

func (ad *AssetDir) Remove(path string) (err error)

func (*AssetDir) RemoveDirectory

func (ad *AssetDir) RemoveDirectory(path string) (err error)

func (*AssetDir) Rename

func (ad *AssetDir) Rename(oldNamePath, newNamePath string) (err error)

func (*AssetDir) Size

func (ad *AssetDir) Size() int64

func (*AssetDir) Stat

func (ad *AssetDir) Stat(path string) (res os.FileInfo, err error)
func (ad *AssetDir) Symlink(oldNamePath, newNamePath string) (err error)

func (*AssetDir) Sys

func (ad *AssetDir) Sys() interface{}

type ContainerConnection

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

func NewContainerConnection

func NewContainerConnection(opts ...ContainerOption) (*ContainerConnection, error)

func (*ContainerConnection) Close

func (c *ContainerConnection) Close() error

func (*ContainerConnection) KeepAlive

func (c *ContainerConnection) KeepAlive() error

func (*ContainerConnection) Read

func (c *ContainerConnection) Read(p []byte) (int, error)

func (*ContainerConnection) SetWinSize

func (c *ContainerConnection) SetWinSize(w, h int) error

func (*ContainerConnection) Write

func (c *ContainerConnection) Write(p []byte) (int, error)

type ContainerOption

type ContainerOption func(*ContainerOptions)

func ContainerHost

func ContainerHost(host string) ContainerOption

func ContainerName

func ContainerName(container string) ContainerOption

func ContainerNamespace

func ContainerNamespace(namespace string) ContainerOption

func ContainerPodName

func ContainerPodName(name string) ContainerOption

func ContainerPtyWin

func ContainerPtyWin(win Windows) ContainerOption

func ContainerSkipTls

func ContainerSkipTls(isSkipTls bool) ContainerOption

func ContainerToken

func ContainerToken(token string) ContainerOption

type ContainerOptions

type ContainerOptions struct {
	Host          string
	Token         string
	PodName       string
	Namespace     string
	ContainerName string
	IsSkipTls     bool
	// contains filtered or unexported fields
}

func (ContainerOptions) K8sCfg

func (o ContainerOptions) K8sCfg() *rest.Config

func (ContainerOptions) String

func (o ContainerOptions) String() string

type ErrNoClient

type ErrNoClient struct {
	Name string
}

func (ErrNoClient) Error

func (e ErrNoClient) Error() string

type ErrUSQLNoSupported

type ErrUSQLNoSupported struct {
	Name string
}

func (ErrUSQLNoSupported) Error

func (e ErrUSQLNoSupported) Error() string

type ExecuteResult

type ExecuteResult struct {
	Finished bool
	Err      error
}

type FakeFileInfo

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

func NewFakeFile

func NewFakeFile(name string, isDir bool) *FakeFileInfo

func NewFakeSymFile

func NewFakeSymFile(name string) *FakeFileInfo

func (*FakeFileInfo) IsDir

func (f *FakeFileInfo) IsDir() bool

func (*FakeFileInfo) ModTime

func (f *FakeFileInfo) ModTime() time.Time

func (*FakeFileInfo) Mode

func (f *FakeFileInfo) Mode() os.FileMode

func (*FakeFileInfo) Name

func (f *FakeFileInfo) Name() string

func (*FakeFileInfo) Size

func (f *FakeFileInfo) Size() int64

func (*FakeFileInfo) Sys

func (f *FakeFileInfo) Sys() interface{}

type FileInfoList

type FileInfoList []os.FileInfo

func (FileInfoList) Len

func (fl FileInfoList) Len() int

func (FileInfoList) Less

func (fl FileInfoList) Less(i, j int) bool

func (FileInfoList) Swap

func (fl FileInfoList) Swap(i, j int)

type FolderBuilderOption

type FolderBuilderOption func(info *folderOptions)

func WitRemoteAddr

func WitRemoteAddr(addr string) FolderBuilderOption

func WithAsset

func WithAsset(asset model.PermAsset) FolderBuilderOption

func WithFolderID

func WithFolderID(id string) FolderBuilderOption

func WithFolderName

func WithFolderName(name string) FolderBuilderOption

func WithFolderUsername

func WithFolderUsername(username string) FolderBuilderOption

func WithFromType

func WithFromType(fromType model.LabelField) FolderBuilderOption

func WithSubFoldersLoadFunc

func WithSubFoldersLoadFunc(loadFunc SubFoldersLoadFunc) FolderBuilderOption

func WithTerminalConfig

func WithTerminalConfig(cfg *model.TerminalConfig) FolderBuilderOption

func WithToken

func WithToken(token *model.ConnectToken) FolderBuilderOption

type K8sCon

type K8sCon struct {
	*localcommand.LocalCommand
	// contains filtered or unexported fields
}

func NewK8sConnection

func NewK8sConnection(ops ...K8sOption) (*K8sCon, error)

func (*K8sCon) KeepAlive

func (k *K8sCon) KeepAlive() error

type K8sOption

type K8sOption func(*k8sOptions)

func K8sClusterServer

func K8sClusterServer(clusterServer string) K8sOption

func K8sExtraEnvs

func K8sExtraEnvs(envs map[string]string) K8sOption

func K8sPtyWin

func K8sPtyWin(win Windows) K8sOption

func K8sSkipTls

func K8sSkipTls(isSkipTls bool) K8sOption

func K8sToken

func K8sToken(token string) K8sOption

func K8sUsername

func K8sUsername(username string) K8sOption

type MongoDBConn

type MongoDBConn struct {
	*localcommand.LocalCommand
	// contains filtered or unexported fields
}

func NewMongoDBConnection

func NewMongoDBConnection(ops ...SqlOption) (*MongoDBConn, error)

func (*MongoDBConn) Close

func (conn *MongoDBConn) Close() error

func (*MongoDBConn) KeepAlive

func (conn *MongoDBConn) KeepAlive() error

type MongoOpt

type MongoOpt func(*url.URL)

func MongoAuth

func MongoAuth(user, password string) MongoOpt

func MongoDBName

func MongoDBName(dbName string) MongoOpt

func MongoHost

func MongoHost(host string) MongoOpt

func MongoParams

func MongoParams(params ...map[string]string) MongoOpt

type NodeDir

type NodeDir struct {
	ID string
	// contains filtered or unexported fields
}

func NewNodeDir

func NewNodeDir(builders ...FolderBuilderOption) NodeDir

func (*NodeDir) IsDir

func (nd *NodeDir) IsDir() bool

func (*NodeDir) List

func (nd *NodeDir) List() (res []os.FileInfo, err error)

func (*NodeDir) ModTime

func (nd *NodeDir) ModTime() time.Time

func (*NodeDir) Mode

func (nd *NodeDir) Mode() os.FileMode

func (*NodeDir) Name

func (nd *NodeDir) Name() string

func (*NodeDir) Size

func (nd *NodeDir) Size() int64

func (*NodeDir) Sys

func (nd *NodeDir) Sys() interface{}

type OpenAIConn

type OpenAIConn struct {
	Id       string
	Client   *openai.Client
	Model    string
	Prompt   string
	Contents []string
	AnswerCh chan string
	DoneCh   chan string
}

func (*OpenAIConn) Chat

func (conn *OpenAIConn) Chat(interruptCurrentChat *bool)

type RedisConn

type RedisConn struct {
	*localcommand.LocalCommand
	// contains filtered or unexported fields
}

func NewRedisConnection

func NewRedisConnection(ops ...SqlOption) (*RedisConn, error)

func (*RedisConn) Close

func (conn *RedisConn) Close() error

func (*RedisConn) KeepAlive

func (conn *RedisConn) KeepAlive() error

type SSHClient

type SSHClient struct {
	*gossh.Client
	Cfg         *SSHClientOptions
	ProxyClient *SSHClient

	sync.Mutex
	// contains filtered or unexported fields
}

func GetClientFromCache

func GetClientFromCache(key string) (client *SSHClient, ok bool)

func NewSSHClient

func NewSSHClient(opts ...SSHClientOption) (*SSHClient, error)

func NewSSHClientWithCfg

func NewSSHClientWithCfg(cfg *SSHClientOptions) (*SSHClient, error)

func NewSSHClientWithToken

func NewSSHClientWithToken(connectToken *model.ConnectToken, timeout int) (*SSHClient, error)

func (*SSHClient) AcquireSession

func (s *SSHClient) AcquireSession() (*gossh.Session, error)

func (*SSHClient) Close

func (s *SSHClient) Close() error

func (*SSHClient) RefCount

func (s *SSHClient) RefCount() int32

func (*SSHClient) ReleaseSession

func (s *SSHClient) ReleaseSession(sess *gossh.Session)

func (*SSHClient) String

func (s *SSHClient) String() string

type SSHClientOption

type SSHClientOption func(conf *SSHClientOptions)

func SSHClientHost

func SSHClientHost(host string) SSHClientOption

func SSHClientKeyboardAuth

func SSHClientKeyboardAuth(keyboardAuth gossh.KeyboardInteractiveChallenge) SSHClientOption

func SSHClientPassphrase

func SSHClientPassphrase(passphrase string) SSHClientOption

func SSHClientPassword

func SSHClientPassword(password string) SSHClientOption

func SSHClientPort

func SSHClientPort(port int) SSHClientOption

func SSHClientPrivateAuth

func SSHClientPrivateAuth(privateAuth gossh.Signer) SSHClientOption

func SSHClientPrivateKey

func SSHClientPrivateKey(privateKey string) SSHClientOption

func SSHClientProxyClient

func SSHClientProxyClient(proxyArgs ...SSHClientOptions) SSHClientOption

func SSHClientTimeout

func SSHClientTimeout(timeout int) SSHClientOption

func SSHClientUsername

func SSHClientUsername(username string) SSHClientOption

type SSHClientOptions

type SSHClientOptions struct {
	Host       string
	Port       string
	Username   string
	Password   string
	PrivateKey string
	Passphrase string
	Timeout    int

	PrivateAuth gossh.Signer
	// contains filtered or unexported fields
}

func (*SSHClientOptions) AuthMethods

func (cfg *SSHClientOptions) AuthMethods() []gossh.AuthMethod

type SSHConnection

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

func NewSSHConnection

func NewSSHConnection(sess *gossh.Session, opts ...SSHOption) (*SSHConnection, error)

func (*SSHConnection) Close

func (sc *SSHConnection) Close() (err error)

func (*SSHConnection) KeepAlive

func (sc *SSHConnection) KeepAlive() error

func (*SSHConnection) Read

func (sc *SSHConnection) Read(p []byte) (n int, err error)

func (*SSHConnection) SetWinSize

func (sc *SSHConnection) SetWinSize(w, h int) error

func (*SSHConnection) Write

func (sc *SSHConnection) Write(p []byte) (n int, err error)

type SSHManager

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

func (*SSHManager) AddClientCache

func (s *SSHManager) AddClientCache(key string, client *SSHClient)

func (*SSHManager) ReleaseClientCacheKey

func (s *SSHManager) ReleaseClientCacheKey(key string, client *SSHClient)

type SSHOption

type SSHOption func(*SSHOptions)

func SSHCharset

func SSHCharset(charset string) SSHOption

func SSHPtyWin

func SSHPtyWin(win Windows) SSHOption

func SSHSudoConfig

func SSHSudoConfig(cfg *SuConfig) SSHOption

func SSHTerm

func SSHTerm(termType string) SSHOption

type SSHOptions

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

type SUMethodType

type SUMethodType string
const (
	SuMethodSudo       SUMethodType = "sudo"
	SuMethodSu         SUMethodType = "su"
	SuMethodOnlySudo   SUMethodType = "only_sudo"
	SuMethodOnlySu     SUMethodType = "only_su"
	SuMethodEnable     SUMethodType = "enable"
	SuMethodSuper      SUMethodType = "super"
	SuMethodSuperLevel SUMethodType = "super_level"
)

func NewSuMethodType

func NewSuMethodType(suMethod string) SUMethodType

type SearchResultDir

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

func (*SearchResultDir) IsDir

func (sd *SearchResultDir) IsDir() bool

func (*SearchResultDir) List

func (sd *SearchResultDir) List() (res []os.FileInfo, err error)

func (*SearchResultDir) ModTime

func (sd *SearchResultDir) ModTime() time.Time

func (*SearchResultDir) Mode

func (sd *SearchResultDir) Mode() os.FileMode

func (*SearchResultDir) Name

func (sd *SearchResultDir) Name() string

func (*SearchResultDir) SetSubDirs

func (sd *SearchResultDir) SetSubDirs(subDirs map[string]os.FileInfo)

func (*SearchResultDir) Size

func (sd *SearchResultDir) Size() int64

func (*SearchResultDir) Sys

func (sd *SearchResultDir) Sys() interface{}

type ServerConnection

type ServerConnection interface {
	io.ReadWriteCloser
	SetWinSize(width, height int) error
	KeepAlive() error
}

type SftpConn

type SftpConn struct {
	HomeDirPath string
	// contains filtered or unexported fields
}

func (*SftpConn) Close

func (s *SftpConn) Close()

func (*SftpConn) DecreaseRef

func (s *SftpConn) DecreaseRef()

func (*SftpConn) IncreaseRef

func (s *SftpConn) IncreaseRef()

func (*SftpConn) IsExpired

func (s *SftpConn) IsExpired() bool

func (*SftpConn) IsOverwriteFile

func (s *SftpConn) IsOverwriteFile() bool

func (*SftpConn) IsRootPath

func (s *SftpConn) IsRootPath(path string) bool

func (*SftpConn) Ref

func (s *SftpConn) Ref() int32

func (*SftpConn) UpdateExpiredTime

func (s *SftpConn) UpdateExpiredTime()

type SftpFile

type SftpFile struct {
	*sftp.File
	FTPLog *model.FTPLog
	// contains filtered or unexported fields
}

func (*SftpFile) Close

func (s *SftpFile) Close() error

type SftpFileInfo

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

func (*SftpFileInfo) IsDir

func (ad *SftpFileInfo) IsDir() bool

func (*SftpFileInfo) ModTime

func (ad *SftpFileInfo) ModTime() time.Time

func (*SftpFileInfo) Mode

func (ad *SftpFileInfo) Mode() os.FileMode

func (*SftpFileInfo) Name

func (ad *SftpFileInfo) Name() string

func (*SftpFileInfo) Size

func (ad *SftpFileInfo) Size() int64

func (*SftpFileInfo) Sys

func (ad *SftpFileInfo) Sys() interface{}

type SftpSession

type SftpSession struct {
	*SftpConn
	// contains filtered or unexported fields
}

func (*SftpSession) Close

func (s *SftpSession) Close()

func (*SftpSession) CloseWithReason

func (s *SftpSession) CloseWithReason(reason model.SessionLifecycleReasonErr)

type SqlOption

type SqlOption func(*sqlOption)

func SqlAllowInvalidCert

func SqlAllowInvalidCert(allowInvalidCert bool) SqlOption

func SqlAssetName

func SqlAssetName(assetName string) SqlOption

func SqlAuthSource

func SqlAuthSource(authSource string) SqlOption

func SqlCaCert

func SqlCaCert(caCert string) SqlOption

func SqlCertKey

func SqlCertKey(certKey string) SqlOption

func SqlClientCert

func SqlClientCert(clientCert string) SqlOption

func SqlConnectionOptions

func SqlConnectionOptions(options string) SqlOption

func SqlDBName

func SqlDBName(dbName string) SqlOption

func SqlHost

func SqlHost(host string) SqlOption

func SqlPGSSLMode

func SqlPGSSLMode(mode string) SqlOption

func SqlPassword

func SqlPassword(password string) SqlOption

func SqlPort

func SqlPort(port int) SqlOption

func SqlPtyWin

func SqlPtyWin(win Windows) SqlOption

func SqlSchema

func SqlSchema(schema string) SqlOption

func SqlUseSSL

func SqlUseSSL(useSSL bool) SqlOption

func SqlUsername

func SqlUsername(username string) SqlOption

type SuConfig

type SuConfig struct {
	MethodType   SUMethodType
	SudoUsername string
	SudoPassword string
}

func (*SuConfig) PasswordMatchPattern

func (s *SuConfig) PasswordMatchPattern() string

func (*SuConfig) SuCommand

func (s *SuConfig) SuCommand() string

func (*SuConfig) SuccessPattern

func (s *SuConfig) SuccessPattern() string

func (*SuConfig) UsernameMatchPattern

func (s *SuConfig) UsernameMatchPattern() string

type SuSwitchService

type SuSwitchService struct {
	SrvConn io.ReadWriteCloser
	// contains filtered or unexported fields
}

func NewSuService

func NewSuService(cfg *SuConfig, srv io.ReadWriteCloser) (*SuSwitchService, error)

func (*SuSwitchService) RunSwitchUser

func (s *SuSwitchService) RunSwitchUser() error

type SubFoldersLoadFunc

type SubFoldersLoadFunc func() map[string]os.FileInfo

type TelnetConfig

type TelnetConfig struct {
	Host     string
	Port     string
	Username string
	Password string
	Term     string
	Charset  string

	Timeout time.Duration

	CustomSuccessPattern  *regexp.Regexp
	CustomUsernamePattern *regexp.Regexp
	CustomPasswordPattern *regexp.Regexp
	// contains filtered or unexported fields
}

type TelnetConnection

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

func NewTelnetConnection

func NewTelnetConnection(opts ...TelnetOption) (*TelnetConnection, error)

func (*TelnetConnection) Close

func (tc *TelnetConnection) Close() (err error)

func (*TelnetConnection) KeepAlive

func (tc *TelnetConnection) KeepAlive() error

func (*TelnetConnection) Read

func (tc *TelnetConnection) Read(p []byte) (n int, err error)

func (*TelnetConnection) SetWinSize

func (tc *TelnetConnection) SetWinSize(w, h int) error

func (*TelnetConnection) Write

func (tc *TelnetConnection) Write(p []byte) (n int, err error)

type TelnetOption

type TelnetOption func(*TelnetConfig)

func TelnetCharset

func TelnetCharset(charset string) TelnetOption

func TelnetCustomPasswordPattern

func TelnetCustomPasswordPattern(passwordPrompt *regexp.Regexp) TelnetOption

func TelnetCustomSuccessPattern

func TelnetCustomSuccessPattern(successPattern *regexp.Regexp) TelnetOption

func TelnetCustomUsernamePattern

func TelnetCustomUsernamePattern(usernamePrompt *regexp.Regexp) TelnetOption

func TelnetHost

func TelnetHost(host string) TelnetOption

func TelnetPort

func TelnetPort(port int) TelnetOption

func TelnetProxyOptions

func TelnetProxyOptions(proxyOpts []SSHClientOptions) TelnetOption

func TelnetPtyWin

func TelnetPtyWin(win Windows) TelnetOption

func TelnetSuConfig

func TelnetSuConfig(cfg *SuConfig) TelnetOption

func TelnetUPassword

func TelnetUPassword(password string) TelnetOption

func TelnetUTimeout

func TelnetUTimeout(timeout int) TelnetOption

func TelnetUsername

func TelnetUsername(username string) TelnetOption

type TransportOption

type TransportOption func(*TransportOptions)

func WithProxy

func WithProxy(proxyURL string) TransportOption

func WithSkipCertificate

func WithSkipCertificate(skip bool) TransportOption

type TransportOptions

type TransportOptions struct {
	UseProxy        bool
	ProxyURL        *url.URL
	SkipCertificate bool
}

type USQLConn

type USQLConn struct {
	*localcommand.LocalCommand
	// contains filtered or unexported fields
}

func NewUSQLConnection

func NewUSQLConnection(opts ...SqlOption) (*USQLConn, error)

func (*USQLConn) Close

func (conn *USQLConn) Close() error

func (*USQLConn) KeepAlive

func (conn *USQLConn) KeepAlive() error

type UserSSHClient

type UserSSHClient struct {
	ID string // 这个 user ssh client key 参考 MakeReuseSSHClientKey
	// contains filtered or unexported fields
}

func (*UserSSHClient) AddClient

func (u *UserSSHClient) AddClient(client *SSHClient)

func (*UserSSHClient) Count

func (u *UserSSHClient) Count() int

func (*UserSSHClient) GetClient

func (u *UserSSHClient) GetClient() *SSHClient

type UserSftpConn

type UserSftpConn struct {
	User *model.User
	Addr string

	Dirs map[string]os.FileInfo
	// contains filtered or unexported fields
}

func NewUserSftpConn

func NewUserSftpConn(jmsService *service.JMService, opts ...UserSftpOption) *UserSftpConn

func (*UserSftpConn) Close

func (u *UserSftpConn) Close()

func (*UserSftpConn) Create

func (u *UserSftpConn) Create(path string) (*SftpFile, error)

func (*UserSftpConn) IsDir

func (u *UserSftpConn) IsDir() bool

func (*UserSftpConn) List

func (u *UserSftpConn) List() (res []os.FileInfo, err error)

func (*UserSftpConn) LoadNodeSubFoldersByKey

func (u *UserSftpConn) LoadNodeSubFoldersByKey(nodeKey string) SubFoldersLoadFunc

func (*UserSftpConn) MkdirAll

func (u *UserSftpConn) MkdirAll(path string) (err error)

func (*UserSftpConn) ModTime

func (u *UserSftpConn) ModTime() time.Time

func (*UserSftpConn) Mode

func (u *UserSftpConn) Mode() os.FileMode

func (*UserSftpConn) Name

func (u *UserSftpConn) Name() string

func (*UserSftpConn) Open

func (u *UserSftpConn) Open(path string) (*SftpFile, error)

func (*UserSftpConn) ParsePath

func (u *UserSftpConn) ParsePath(path string) (fi os.FileInfo, restPath string)

func (*UserSftpConn) ReadDir

func (u *UserSftpConn) ReadDir(path string) (res []os.FileInfo, err error)
func (u *UserSftpConn) ReadLink(path string) (name string, err error)

func (*UserSftpConn) Remove

func (u *UserSftpConn) Remove(path string) (err error)

func (*UserSftpConn) RemoveDirectory

func (u *UserSftpConn) RemoveDirectory(path string) (err error)

func (*UserSftpConn) Rename

func (u *UserSftpConn) Rename(oldNamePath, newNamePath string) (err error)

func (*UserSftpConn) Search

func (u *UserSftpConn) Search(key string) (res []os.FileInfo, err error)

func (*UserSftpConn) Size

func (u *UserSftpConn) Size() int64

func (*UserSftpConn) Stat

func (u *UserSftpConn) Stat(path string) (res os.FileInfo, err error)
func (u *UserSftpConn) Symlink(oldNamePath, newNamePath string) (err error)

func (*UserSftpConn) Sys

func (u *UserSftpConn) Sys() interface{}

type UserSftpOption

type UserSftpOption func(*userSftpOption)

func WithAccountUsername

func WithAccountUsername(username string) UserSftpOption

func WithAssets

func WithAssets(assets []model.PermAsset) UserSftpOption

func WithConnectToken

func WithConnectToken(token *model.ConnectToken) UserSftpOption

func WithLoginFrom

func WithLoginFrom(loginFrom model.LabelField) UserSftpOption

func WithRemoteAddr

func WithRemoteAddr(addr string) UserSftpOption

func WithTerminalCfg

func WithTerminalCfg(cfg *model.TerminalConfig) UserSftpOption

func WithUser

func WithUser(user *model.User) UserSftpOption

type Windows

type Windows struct {
	Width  int
	Height int
}

Jump to

Keyboard shortcuts

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