Documentation ¶
Index ¶
- Constants
- func GetClientFromCache(key string) (client *sshClient, ok bool)
- func GetPubKeyFromFile(keypath string) (ssh.Signer, error)
- func KeepAlive(c *sshClient, closed <-chan struct{}, keepInterval time.Duration)
- func MakeReuseSSHClientKey(user *model.User, asset *model.Asset, systemUser *model.SystemUser) string
- func NewClient(user *model.User, asset *model.Asset, systemUser *model.SystemUser, ...) (client *sshClient, err error)
- type AssetDir
- func (ad *AssetDir) Create(path string) (*sftp.File, error)
- func (ad *AssetDir) CreateFTPLog(su *model.SystemUser, operate, filename string, isSuccess bool)
- func (ad *AssetDir) GetSFTPAndRealPath(su *model.SystemUser, path string) (conn *SftpConn, realPath string)
- func (ad *AssetDir) GetSftpClient(su *model.SystemUser) (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) (*sftp.File, 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 FakeFileInfo
- type FileInfoList
- type NodeDir
- type SSHClientConfig
- type SSHManager
- 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 ServerMysqlConnection
- func (dbconn *ServerMysqlConnection) Close() (err error)
- func (dbconn *ServerMysqlConnection) Connect() (err error)
- func (dbconn *ServerMysqlConnection) Protocol() string
- func (dbconn *ServerMysqlConnection) Read(p []byte) (int, error)
- func (dbconn *ServerMysqlConnection) SetWinSize(w, h int) error
- func (dbconn *ServerMysqlConnection) Timeout() time.Duration
- func (dbconn *ServerMysqlConnection) Write(p []byte) (int, error)
- type ServerSSHConnection
- func (sc *ServerSSHConnection) Close() (err error)
- func (sc *ServerSSHConnection) Connect(h, w int, term string) (err error)
- func (sc *ServerSSHConnection) Protocol() string
- func (sc *ServerSSHConnection) Read(p []byte) (n int, err error)
- func (sc *ServerSSHConnection) SetWinSize(w, h int) error
- func (sc *ServerSSHConnection) Write(p []byte) (n int, err error)
- type ServerTelnetConnection
- func (tc *ServerTelnetConnection) Close() (err error)
- func (tc *ServerTelnetConnection) Connect(h, w int, term string) (err error)
- func (tc *ServerTelnetConnection) Protocol() string
- func (tc *ServerTelnetConnection) Read(p []byte) (n int, err error)
- func (tc *ServerTelnetConnection) SetWinSize(w, h int) error
- func (tc *ServerTelnetConnection) Timeout() time.Duration
- func (tc *ServerTelnetConnection) Write(p []byte) (n int, err error)
- type SftpConn
- type SqlOption
- type SqlOptions
- type UserSSHClient
- type UserSftpConn
- func (u *UserSftpConn) Close()
- func (u *UserSftpConn) Create(path string) (*sftp.File, error)
- func (u *UserSftpConn) IsDir() bool
- func (u *UserSftpConn) List() (res []os.FileInfo, err error)
- 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) (*sftp.File, 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{}
Constants ¶
View Source
const (
SearchFolderName = "_Search"
)
Variables ¶
This section is empty.
Functions ¶
func GetClientFromCache ¶
func MakeReuseSSHClientKey ¶
Types ¶
type AssetDir ¶
type AssetDir struct { ShowHidden bool Overtime time.Duration // contains filtered or unexported fields }
func NewAssetDir ¶
func (*AssetDir) CreateFTPLog ¶
func (ad *AssetDir) CreateFTPLog(su *model.SystemUser, operate, filename string, isSuccess bool)
func (*AssetDir) GetSFTPAndRealPath ¶
func (*AssetDir) GetSftpClient ¶
func (ad *AssetDir) GetSftpClient(su *model.SystemUser) (conn *SftpConn, err error)
func (*AssetDir) IsUniqueSu ¶
func (*AssetDir) RemoveDirectory ¶
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 SSHClientConfig ¶
type SSHClientConfig struct { Host string `json:"host"` Port string `json:"port"` User string `json:"user"` Password string `json:"password"` PrivateKey string `json:"private_key"` PrivateKeyPath string `json:"private_key_path"` Timeout time.Duration `json:"timeout"` Proxy []*SSHClientConfig // contains filtered or unexported fields }
func MakeConfig ¶
func MakeConfig(asset *model.Asset, systemUser *model.SystemUser, timeout time.Duration) (conf *SSHClientConfig)
func (*SSHClientConfig) Config ¶
func (sc *SSHClientConfig) Config() (config *gossh.ClientConfig, err error)
func (*SSHClientConfig) DialProxy ¶
func (sc *SSHClientConfig) DialProxy() (client *gossh.Client, err error)
func (*SSHClientConfig) String ¶
func (sc *SSHClientConfig) String() string
type SSHManager ¶
type SSHManager struct {
// contains filtered or unexported fields
}
func (*SSHManager) AddClientCache ¶
func (s *SSHManager) AddClientCache(key string, client *sshClient)
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 Protocol() string SetWinSize(width, height int) error }
type ServerMysqlConnection ¶
type ServerMysqlConnection struct {
// contains filtered or unexported fields
}
func NewMysqlServer ¶
func NewMysqlServer(ops ...SqlOption) *ServerMysqlConnection
func (*ServerMysqlConnection) Close ¶
func (dbconn *ServerMysqlConnection) Close() (err error)
func (*ServerMysqlConnection) Connect ¶
func (dbconn *ServerMysqlConnection) Connect() (err error)
func (*ServerMysqlConnection) Protocol ¶
func (dbconn *ServerMysqlConnection) Protocol() string
func (*ServerMysqlConnection) Read ¶
func (dbconn *ServerMysqlConnection) Read(p []byte) (int, error)
func (*ServerMysqlConnection) SetWinSize ¶
func (dbconn *ServerMysqlConnection) SetWinSize(w, h int) error
func (*ServerMysqlConnection) Timeout ¶
func (dbconn *ServerMysqlConnection) Timeout() time.Duration
type ServerSSHConnection ¶
type ServerSSHConnection struct {
// contains filtered or unexported fields
}
func NewServerSSHConnection ¶
func NewServerSSHConnection(sess *gossh.Session) *ServerSSHConnection
func (*ServerSSHConnection) Close ¶
func (sc *ServerSSHConnection) Close() (err error)
func (*ServerSSHConnection) Connect ¶
func (sc *ServerSSHConnection) Connect(h, w int, term string) (err error)
func (*ServerSSHConnection) Protocol ¶
func (sc *ServerSSHConnection) Protocol() string
func (*ServerSSHConnection) SetWinSize ¶
func (sc *ServerSSHConnection) SetWinSize(w, h int) error
type ServerTelnetConnection ¶
type ServerTelnetConnection struct { User *model.User Asset *model.Asset SystemUser *model.SystemUser Overtime time.Duration CustomString string CustomSuccessPattern *regexp.Regexp // contains filtered or unexported fields }
func (*ServerTelnetConnection) Close ¶
func (tc *ServerTelnetConnection) Close() (err error)
func (*ServerTelnetConnection) Connect ¶
func (tc *ServerTelnetConnection) Connect(h, w int, term string) (err error)
func (*ServerTelnetConnection) Protocol ¶
func (tc *ServerTelnetConnection) Protocol() string
func (*ServerTelnetConnection) Read ¶
func (tc *ServerTelnetConnection) Read(p []byte) (n int, err error)
func (*ServerTelnetConnection) SetWinSize ¶
func (tc *ServerTelnetConnection) SetWinSize(w, h int) error
func (*ServerTelnetConnection) Timeout ¶
func (tc *ServerTelnetConnection) Timeout() time.Duration
type SftpConn ¶
type SftpConn struct { HomeDirPath string // contains filtered or unexported fields }
type SqlOptions ¶
func (*SqlOptions) CommandArgs ¶
func (opts *SqlOptions) CommandArgs() []string
func (*SqlOptions) Envs ¶
func (opts *SqlOptions) Envs() []string
type UserSSHClient ¶
type UserSSHClient struct { ID string // userID_assetID_systemUserID_systemUsername // contains filtered or unexported fields }
func (*UserSSHClient) AddClient ¶
func (u *UserSSHClient) AddClient(client *sshClient)
func (*UserSSHClient) DeleteClient ¶
func (u *UserSSHClient) DeleteClient(client *sshClient)
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(user *model.User, addr string) *UserSftpConn
func (*UserSftpConn) Close ¶
func (u *UserSftpConn) Close()
func (*UserSftpConn) IsDir ¶
func (u *UserSftpConn) IsDir() bool
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{}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.