Documentation ¶
Overview ¶
* @Author: duanzt * @Date: 2023-07-14 10:27:51 * @LastEditors: duanzt * @LastEditTime: 2023-07-17 13:12:18 * @FilePath: connection.go * @Description: 远程ssh连接 * * Copyright (c) 2023 by duanzt, All Rights Reserved.
* @Author: duanzt * @Date: 2023-07-14 10:27:38 * @LastEditors: duanzt * @LastEditTime: 2023-07-14 11:28:56 * @FilePath: session.go * @Description: 远程ssh session管理 * * Copyright (c) 2023 by duanzt, All Rights Reserved.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewConnection1 ¶
func NewConnection1(username, password, addr string) (internal.IConnection, error)
NewConnection1 新建连接(通过username+password方式)
@author duanzt @date 2023-07-14 05:15:59 @param username string 用户名 @param password string 密码 @param addr string ssh连接地址 @return internal.IConnection ssh连接对象 @return error 连接异常时返回
func NewConnection2 ¶
func NewConnection2(username, privateKey, addr string) (internal.IConnection, error)
NewConnection2 新建连接(通过username+私钥方式)
@author duanzt @date 2023-07-14 05:16:52 @param username string 用户名 @param privateKey string 私钥文件地址 @param addr string ssh连接地址 @return internal.IConnection ssh连接 @return error 连接异常时返回
func NewConnectionDefault ¶
func NewConnectionDefault(addr string) (internal.IConnection, error)
NewConnectionDefault 使用默认方式新建连接(默认用户名:root,默认使用私钥连接,私钥地址为当前目录下的.ssh/id_rsa文件)
@author duanzt @date 2023-07-14 06:16:26 @param addr string ssh连接地址 @return internal.IConnection ssh连接 @return error 连接异常时返回
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.