Documentation ¶
Index ¶
- Variables
- func InitSSHConfig() ssh.Config
- type GwSSHClient
- type SSHClientOption
- func SetSSHClientHost(host string) SSHClientOption
- func SetSSHClientKeyboardAuth(keyboardAuth ssh.KeyboardInteractiveChallenge) SSHClientOption
- func SetSSHClientPassphrase(passphrase string) SSHClientOption
- func SetSSHClientPassword(password string) SSHClientOption
- func SetSSHClientPort(port int) SSHClientOption
- func SetSSHClientPrivateAuth(privateAuth ssh.Signer) SSHClientOption
- func SetSSHClientPrivateKey(privateKey string) SSHClientOption
- func SetSSHClientTimeout(timeout int) SSHClientOption
- func SetSSHClientUsername(username string) SSHClientOption
- type SSHClientOptions
- type SSHClientsManager
- type SShClient2Add
- type UserSSHClient
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NotRecommendCiphers = []string{ "arcfour256", "arcfour128", "arcfour", "aes128-cbc", "3des-cbc", } NotRecommendKeyExchanges = []string{ "diffie-hellman-group1-sha1", "diffie-hellman-group-exchange-sha1", "diffie-hellman-group-exchange-sha256", } )
Functions ¶
func InitSSHConfig ¶
Types ¶
type GwSSHClient ¶
type GwSSHClient struct { sync.Mutex *ssh.Client Config *SSHClientOptions //代理连接 ProxyClient *SSHClient // contains filtered or unexported fields }
func NewGwSSHClient ¶
func NewGwSSHClient(opts ...SSHClientOption) (*GwSSHClient, error)
初始化网关用的SSH客户端
func NewSSHClientWithCfg ¶
func NewSSHClientWithCfg(cfg *SSHClientOptions) (*GwSSHClient, error)
初始化网关用的SSH客户端
func (*GwSSHClient) AcquireSession ¶
func (s *GwSSHClient) AcquireSession() (*ssh.Session, error)
获取复用连接
func (*GwSSHClient) Close ¶
func (s *GwSSHClient) Close() error
func (*GwSSHClient) ReleaseSession ¶
func (s *GwSSHClient) ReleaseSession(sshSession *ssh.Session)
func (*GwSSHClient) String ¶
func (s *GwSSHClient) String() string
type SSHClientOption ¶
type SSHClientOption func(conf *SSHClientOptions)
func SetSSHClientHost ¶
func SetSSHClientHost(host string) SSHClientOption
func SetSSHClientKeyboardAuth ¶
func SetSSHClientKeyboardAuth(keyboardAuth ssh.KeyboardInteractiveChallenge) SSHClientOption
func SetSSHClientPassphrase ¶
func SetSSHClientPassphrase(passphrase string) SSHClientOption
func SetSSHClientPassword ¶
func SetSSHClientPassword(password string) SSHClientOption
func SetSSHClientPort ¶
func SetSSHClientPort(port int) SSHClientOption
func SetSSHClientPrivateAuth ¶
func SetSSHClientPrivateAuth(privateAuth ssh.Signer) SSHClientOption
func SetSSHClientPrivateKey ¶
func SetSSHClientPrivateKey(privateKey string) SSHClientOption
func SetSSHClientTimeout ¶
func SetSSHClientTimeout(timeout int) SSHClientOption
func SetSSHClientUsername ¶
func SetSSHClientUsername(username string) SSHClientOption
type SSHClientOptions ¶
type SSHClientsManager ¶
func NewSSHClientsManager ¶
func NewSSHClientsManager() *SSHClientsManager
func (*SSHClientsManager) GetClientsMap ¶
func (m *SSHClientsManager) GetClientsMap() map[string]*UserSSHClient
type SShClient2Add ¶
type SShClient2Add struct { UniqId string *GwSSHClient }
type UserSSHClient ¶
type UserSSHClient struct { UniqId string // uniqid // contains filtered or unexported fields }
func NewUserSSHClient ¶
func NewUserSSHClient(uniq_id string) *UserSSHClient
func (*UserSSHClient) AddSshClient ¶
func (c *UserSSHClient) AddSshClient(client *GwSSHClient)
加入ssh-client
func (*UserSSHClient) Count ¶
func (c *UserSSHClient) Count() int
func (*UserSSHClient) GetSshClient ¶
func (c *UserSSHClient) GetSshClient() (*GwSSHClient, error)
获取可用的client
func (*UserSSHClient) RemoveSshClient ¶
func (c *UserSSHClient) RemoveSshClient(client *GwSSHClient)
Click to show internal directories.
Click to hide internal directories.