Documentation ¶
Index ¶
- Constants
- Variables
- func AddClientCache(key string, client *SSHClient)
- func BuildMongoDBURI(opts ...MongoOpt) string
- func BuildNobodyWithOpts(opts ...localcommand.Option) (nobodyOpts []localcommand.Option, err error)
- func ClearTempFileDelay(sleepTime time.Duration, filepath ...string)
- func DoLogin(opt *sqlOption, lcmd *localcommand.LocalCommand, dbType string) (*localcommand.LocalCommand, error)
- func FindAvailableShell(opt *ContainerOptions) (shell string, err error)
- func HasShellInContainer(opt *ContainerOptions, shell string) error
- func IsExistPath(client *sftp.Client, path string) bool
- func IsSupportedProtocol(p string) error
- func IsValidK8sUserToken(o *k8sOptions) bool
- func LoginToSSHSu(sc *SSHConnection) error
- func LoginToTelnetSu(sc *TelnetConnection) error
- func MakeReuseSSHClientKey(userId, assetId, account, ip, username string) string
- func MatchLoginPrefix(prefix string, dbType string, lcmd *localcommand.LocalCommand) (*localcommand.LocalCommand, error)
- func NewCustomTransport(options ...TransportOption) *http.Transport
- func NewOpenAIClient(authToken, baseURL, proxy string) *openai.Client
- func NewSftpConn(sess *gossh.Session) (*sftp.Client, error)
- func NewSftpFileInfo(info os.FileInfo, isRoot bool) os.FileInfo
- func ReleaseClientCacheKey(key string, client *SSHClient)
- func StoreCAFileToLocal(caCert string) (string, error)
- func StorePrivateKeyFileToLocal(caCert string) (string, error)
- func SupportedDBProtocols() []string
- func SupportedHostProtocols() []string
- func SupportedProtocols() []string
- type AssetDir
- func (ad *AssetDir) Create(path string) (*SftpFile, error)
- func (ad *AssetDir) CreateFTPLog(su *model.PermAccount, operate, filename string, isSuccess bool) *model.FTPLog
- func (ad *AssetDir) GetSFTPAndRealPath(su *model.PermAccount, path string) (conn *SftpConn, realPath string)
- func (ad *AssetDir) GetSftpClient(su *model.PermAccount) (conn *SftpConn, err error)
- func (ad *AssetDir) IsDir() bool
- func (ad *AssetDir) IsUniqueSu() (folderName string, ok bool)
- func (ad *AssetDir) MkdirAll(path string) (err error)
- func (ad *AssetDir) ModTime() time.Time
- func (ad *AssetDir) Mode() os.FileMode
- func (ad *AssetDir) Name() string
- func (ad *AssetDir) Open(path string) (*SftpFile, error)
- func (ad *AssetDir) ReadDir(path string) (res []os.FileInfo, err error)
- func (ad *AssetDir) ReadLink(path string) (res string, err error)
- func (ad *AssetDir) Remove(path string) (err error)
- func (ad *AssetDir) RemoveDirectory(path string) (err error)
- func (ad *AssetDir) Rename(oldNamePath, newNamePath string) (err error)
- func (ad *AssetDir) Size() int64
- func (ad *AssetDir) Stat(path string) (res os.FileInfo, err error)
- func (ad *AssetDir) Symlink(oldNamePath, newNamePath string) (err error)
- func (ad *AssetDir) Sys() interface{}
- type ContainerConnection
- type ContainerOption
- func ContainerHost(host string) ContainerOption
- func ContainerName(container string) ContainerOption
- func ContainerNamespace(namespace string) ContainerOption
- func ContainerPodName(name string) ContainerOption
- func ContainerPtyWin(win Windows) ContainerOption
- func ContainerSkipTls(isSkipTls bool) ContainerOption
- func ContainerToken(token string) ContainerOption
- type ContainerOptions
- type ErrNoClient
- type ErrUSQLNoSupported
- type ExecuteResult
- type FakeFileInfo
- type FileInfoList
- type FolderBuilderOption
- func WitRemoteAddr(addr string) FolderBuilderOption
- func WithAsset(asset model.PermAsset) FolderBuilderOption
- func WithFolderID(id string) FolderBuilderOption
- func WithFolderName(name string) FolderBuilderOption
- func WithFolderUsername(username string) FolderBuilderOption
- func WithFromType(fromType model.LabelField) FolderBuilderOption
- func WithSubFoldersLoadFunc(loadFunc SubFoldersLoadFunc) FolderBuilderOption
- func WithTerminalConfig(cfg *model.TerminalConfig) FolderBuilderOption
- func WithToken(token *model.ConnectToken) FolderBuilderOption
- type K8sCon
- type K8sOption
- type MongoDBConn
- type MongoOpt
- type NodeDir
- type OpenAIConn
- type RedisConn
- type SSHClient
- type SSHClientOption
- func SSHClientHost(host string) SSHClientOption
- func SSHClientKeyboardAuth(keyboardAuth gossh.KeyboardInteractiveChallenge) SSHClientOption
- func SSHClientPassphrase(passphrase string) SSHClientOption
- func SSHClientPassword(password string) SSHClientOption
- func SSHClientPort(port int) SSHClientOption
- func SSHClientPrivateAuth(privateAuth gossh.Signer) SSHClientOption
- func SSHClientPrivateKey(privateKey string) SSHClientOption
- func SSHClientProxyClient(proxyArgs ...SSHClientOptions) SSHClientOption
- func SSHClientTimeout(timeout int) SSHClientOption
- func SSHClientUsername(username string) SSHClientOption
- type SSHClientOptions
- type SSHConnection
- type SSHManager
- type SSHOption
- type SSHOptions
- type SUMethodType
- type SearchResultDir
- func (sd *SearchResultDir) IsDir() bool
- func (sd *SearchResultDir) List() (res []os.FileInfo, err error)
- func (sd *SearchResultDir) ModTime() time.Time
- func (sd *SearchResultDir) Mode() os.FileMode
- func (sd *SearchResultDir) Name() string
- func (sd *SearchResultDir) SetSubDirs(subDirs map[string]os.FileInfo)
- func (sd *SearchResultDir) Size() int64
- func (sd *SearchResultDir) Sys() interface{}
- type ServerConnection
- type SftpConn
- type SftpFile
- type SftpFileInfo
- type SftpSession
- type SqlOption
- func SqlAllowInvalidCert(allowInvalidCert bool) SqlOption
- func SqlAssetName(assetName string) SqlOption
- func SqlAuthSource(authSource string) SqlOption
- func SqlCaCert(caCert string) SqlOption
- func SqlCertKey(certKey string) SqlOption
- func SqlClientCert(clientCert string) SqlOption
- func SqlConnectionOptions(options string) SqlOption
- func SqlDBName(dbName string) SqlOption
- func SqlHost(host string) SqlOption
- func SqlPGSSLMode(mode string) SqlOption
- func SqlPassword(password string) SqlOption
- func SqlPort(port int) SqlOption
- func SqlPtyWin(win Windows) SqlOption
- func SqlSchema(schema string) SqlOption
- func SqlUseSSL(useSSL bool) SqlOption
- func SqlUsername(username string) SqlOption
- type SuConfig
- type SuSwitchService
- type SubFoldersLoadFunc
- type TelnetConfig
- type TelnetConnection
- type TelnetOption
- func TelnetCharset(charset string) TelnetOption
- func TelnetCustomPasswordPattern(passwordPrompt *regexp.Regexp) TelnetOption
- func TelnetCustomSuccessPattern(successPattern *regexp.Regexp) TelnetOption
- func TelnetCustomUsernamePattern(usernamePrompt *regexp.Regexp) TelnetOption
- func TelnetHost(host string) TelnetOption
- func TelnetPort(port int) TelnetOption
- func TelnetProxyOptions(proxyOpts []SSHClientOptions) TelnetOption
- func TelnetPtyWin(win Windows) TelnetOption
- func TelnetSuConfig(cfg *SuConfig) TelnetOption
- func TelnetUPassword(password string) TelnetOption
- func TelnetUTimeout(timeout int) TelnetOption
- func TelnetUsername(username string) TelnetOption
- type TransportOption
- type TransportOptions
- type USQLConn
- type UserSSHClient
- type UserSftpConn
- func (u *UserSftpConn) Close()
- func (u *UserSftpConn) Create(path string) (*SftpFile, error)
- func (u *UserSftpConn) IsDir() bool
- func (u *UserSftpConn) List() (res []os.FileInfo, err error)
- func (u *UserSftpConn) LoadNodeSubFoldersByKey(nodeKey string) SubFoldersLoadFunc
- func (u *UserSftpConn) MkdirAll(path string) (err error)
- func (u *UserSftpConn) ModTime() time.Time
- func (u *UserSftpConn) Mode() os.FileMode
- func (u *UserSftpConn) Name() string
- func (u *UserSftpConn) Open(path string) (*SftpFile, error)
- func (u *UserSftpConn) ParsePath(path string) (fi os.FileInfo, restPath string)
- func (u *UserSftpConn) ReadDir(path string) (res []os.FileInfo, err error)
- func (u *UserSftpConn) ReadLink(path string) (name string, err error)
- func (u *UserSftpConn) Remove(path string) (err error)
- func (u *UserSftpConn) RemoveDirectory(path string) (err error)
- func (u *UserSftpConn) Rename(oldNamePath, newNamePath string) (err error)
- func (u *UserSftpConn) Search(key string) (res []os.FileInfo, err error)
- func (u *UserSftpConn) Size() int64
- func (u *UserSftpConn) Stat(path string) (res os.FileInfo, err error)
- func (u *UserSftpConn) Symlink(oldNamePath, newNamePath string) (err error)
- func (u *UserSftpConn) Sys() interface{}
- type UserSftpOption
- func WithAccountUsername(username string) UserSftpOption
- func WithAssets(assets []model.PermAsset) UserSftpOption
- func WithConnectToken(token *model.ConnectToken) UserSftpOption
- func WithLoginFrom(loginFrom model.LabelField) UserSftpOption
- func WithRemoteAddr(addr string) UserSftpOption
- func WithTerminalCfg(cfg *model.TerminalConfig) UserSftpOption
- func WithUser(user *model.User) UserSftpOption
- type Windows
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 BuildMongoDBURI ¶
func BuildNobodyWithOpts ¶
func BuildNobodyWithOpts(opts ...localcommand.Option) (nobodyOpts []localcommand.Option, err error)
func ClearTempFileDelay ¶
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 IsSupportedProtocol ¶
func IsValidK8sUserToken ¶
func IsValidK8sUserToken(o *k8sOptions) bool
func LoginToSSHSu ¶
func LoginToSSHSu(sc *SSHConnection) error
func LoginToTelnetSu ¶
func LoginToTelnetSu(sc *TelnetConnection) error
func MakeReuseSSHClientKey ¶
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 ReleaseClientCacheKey ¶
func StoreCAFileToLocal ¶
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 (*AssetDir) CreateFTPLog ¶
func (*AssetDir) GetSFTPAndRealPath ¶
func (*AssetDir) GetSftpClient ¶
func (ad *AssetDir) GetSftpClient(su *model.PermAccount) (conn *SftpConn, err error)
func (*AssetDir) IsUniqueSu ¶
func (*AssetDir) RemoveDirectory ¶
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) SetWinSize ¶
func (c *ContainerConnection) SetWinSize(w, h 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 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 ¶
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 ¶
type K8sOption ¶
type K8sOption func(*k8sOptions)
func K8sClusterServer ¶
func K8sExtraEnvs ¶
func K8sSkipTls ¶
func K8sUsername ¶
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 NodeDir ¶
type NodeDir struct { ID string // contains filtered or unexported fields }
func NewNodeDir ¶
func NewNodeDir(builders ...FolderBuilderOption) NodeDir
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 ¶
type SSHClient ¶
type SSHClient struct { *gossh.Client Cfg *SSHClientOptions ProxyClient *SSHClient sync.Mutex // contains filtered or unexported fields }
func GetClientFromCache ¶
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) ReleaseSession ¶
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) SetWinSize ¶
func (sc *SSHConnection) SetWinSize(w, h int) 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 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) 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) DecreaseRef ¶
func (s *SftpConn) DecreaseRef()
func (*SftpConn) IncreaseRef ¶
func (s *SftpConn) IncreaseRef()
func (*SftpConn) IsOverwriteFile ¶
func (*SftpConn) IsRootPath ¶
func (*SftpConn) UpdateExpiredTime ¶
func (s *SftpConn) UpdateExpiredTime()
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 SqlAssetName ¶
func SqlAuthSource ¶
func SqlCertKey ¶
func SqlClientCert ¶
func SqlConnectionOptions ¶
func SqlPGSSLMode ¶
func SqlPassword ¶
func SqlUsername ¶
type SuConfig ¶
type SuConfig struct { MethodType SUMethodType SudoUsername string SudoPassword string }
func (*SuConfig) PasswordMatchPattern ¶
func (*SuConfig) SuccessPattern ¶
func (*SuConfig) UsernameMatchPattern ¶
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 TelnetConfig ¶
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) SetWinSize ¶
func (tc *TelnetConnection) SetWinSize(w, h int) 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 USQLConn ¶
type USQLConn struct { *localcommand.LocalCommand // contains filtered or unexported fields }
func NewUSQLConnection ¶
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) IsDir ¶
func (u *UserSftpConn) IsDir() bool
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) 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 (*UserSftpConn) ReadLink ¶
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) Symlink ¶
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
Source Files ¶
- conn.go
- conn_k8s.go
- conn_k8s_container.go
- conn_mongodb.go
- conn_nobody.go
- conn_openai.go
- conn_redis.go
- conn_sftp.go
- conn_sql_opt.go
- conn_ssh.go
- conn_ssh_su.go
- conn_telnet.go
- conn_telnet_su.go
- conn_usql.go
- connmanager.go
- sftp_asset.go
- sftp_node.go
- sftp_session.go
- sftpconn.go
- sftpfile.go
- ssh.go
- sshclients.go
Click to show internal directories.
Click to hide internal directories.