Documentation ¶
Index ¶
- Constants
- Variables
- func AddClientCache(key string, client *SSHClient)
- func IsSupportedProtocol(p string) error
- func MakeReuseSSHClientKey(userId, assetId, systemUserId, ip, username string) string
- type SSHClient
- type SSHClientOption
- func BuildSSHClientOptions(asset *model.Asset, systemUser *model.SystemUser) []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 SSHClientTimeout(timeout int) SSHClientOption
- func SSHClientUsername(username string) SSHClientOption
- type SSHClientOptions
- type SSHConnection
- type SSHManager
- type SSHOption
- type SSHOptions
- type ServerConnection
- type UserSSHClient
- type Windows
Constants ¶
View Source
const (
ProtocolSSH = "ssh"
)
Variables ¶
View Source
var ( ErrGatewayDial = errors.New("gateway dial addr failed") ErrSSHClient = errors.New("new ssh client failed") )
View Source
var (
ErrUnSupportedProtocol = errors.New("unsupported protocol")
)
Functions ¶
func AddClientCache ¶
func IsSupportedProtocol ¶
func MakeReuseSSHClientKey ¶
Types ¶
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 (*SSHClient) ReleaseSession ¶
type SSHClientOption ¶
type SSHClientOption func(conf *SSHClientOptions)
func BuildSSHClientOptions ¶
func BuildSSHClientOptions(asset *model.Asset, systemUser *model.SystemUser) []SSHClientOption
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 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)
type SSHOption ¶
type SSHOption func(*SSHOptions)
type SSHOptions ¶
type SSHOptions struct {
// contains filtered or unexported fields
}
type ServerConnection ¶
type ServerConnection interface { io.ReadWriteCloser SetWinSize(width, height int) error KeepAlive() error }
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) Count ¶
func (u *UserSSHClient) Count() int
func (*UserSSHClient) GetClient ¶
func (u *UserSSHClient) GetClient() *SSHClient
Click to show internal directories.
Click to hide internal directories.