Documentation ¶
Overview ¶
* @Author: duanzt * @Date: 2023-07-14 10:26:52 * @LastEditors: duanzt * @LastEditTime: 2023-07-17 18:54:52 * @FilePath: gossh.go * @Description: 暴露文件,提供使用的方法 * * Copyright (c) 2023 by duanzt, All Rights Reserved.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Local ¶
func Local() internal.IConnection
Local 获取本地ssh连接()
@author duanzt @date 2023-07-14 05:05:44 @return internal.IConnection
func Remote1 ¶
func Remote1(username, password, addr string) (internal.IConnection, error)
Remote1 获取远程ssh连接(使用username+password验证方式)
@author duanzt @date 2023-07-14 04:59:22 @param username string 用户名 @param password string 密码 @param addr string ssh连接地址,例如:192.168.10.100:22(只传入ip的情况会默认使用22端口) @return internal.IConnection ssh连接 @return error 连接异常时返回
func Remote2 ¶
func Remote2(username, privateKey, addr string) (internal.IConnection, error)
Remote2 获取远程ssh连接(使用username+私钥验证方式)
@author duanzt @date 2023-07-14 05:01:36 @param user string 用户名 @param privateKey string 私钥地址 @param addr string ssh连接地址,例如:192.168.10.100:22(只传入ip的情况会默认使用22端口) @return internal.IConnection ssh连接 @return error 连接异常时返回
func RemoteDefault ¶
func RemoteDefault(addr string) (internal.IConnection, error)
RemoteDefault 获取远程ssh连接(使用username+默认私钥验证方式) 注意:请添加以下公钥到目标机器的/root/.ssh/authorized_keys文件中 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDP3qG9zzNQkhKuWWJTCHAuY04bQ9h/vhZplVrTSnEoWL1SsbT7v/dCDXuyazNDo9ikd9BS6H/nE5lOKp+Omi1W2uWs/kxrCNhouXRO8kMLViRB3DRP2VYFDo36UafzNdGKkH/vW4Ptilga/ucForW05SindT3KeKf+tB1u3RBlRz6rzpeuqrflVtcaWtQ33exWMO8CxgzCtsDexWWLP+TLdeOaWyfn0hj4tf36+K7oENAzGGhQuEwETiMUkJKfykBThBenWgU9mM1/5VbgvGiW7xIoeyDX8RI6Lz5q8mb3+ajuEqPyX/qwiNasYkQ7bWGaLDAVF3yJ20w7EpP54yi9rEoiBt6GAEo2JX5OuibzwMsz2CCykiB8H4YyiOlBY0q5GwrXC87fslvEt4KcYdk/XrZT+ikrJePgTCbQJhUGf8yYe1aDKoTBf/uIuT/O7aJ49KxnfeQdxel3xIykyROxnNisQ8Iz3vdC/QZlZsQUnJzo0UXtwDpwmwLwjpLFCMM= [email protected]
@author duanzt @date 2023-07-14 06:24:43 @param addr string @return internal.IConnection @return error
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
* @Author: duanzt * @Date: 2023-07-14 09:41:38 * @LastEditors: duanzt * @LastEditTime: 2023-07-17 13:10:00 * @FilePath: iconnection.go * @Description: 定义connection interface * * Copyright (c) 2023 by duanzt, All Rights Reserved.
|
* @Author: duanzt * @Date: 2023-07-14 09:41:38 * @LastEditors: duanzt * @LastEditTime: 2023-07-17 13:10:00 * @FilePath: iconnection.go * @Description: 定义connection interface * * Copyright (c) 2023 by duanzt, All Rights Reserved. |
local
* @Author: duanzt * @Date: 2023-07-14 10:27:45 * @LastEditors: duanzt * @LastEditTime: 2023-07-17 18:53:14 * @FilePath: connection.go * @Description: 本地连接(逻辑上,并没有建立任何连接) * * Copyright (c) 2023 by duanzt, All Rights Reserved.
|
* @Author: duanzt * @Date: 2023-07-14 10:27:45 * @LastEditors: duanzt * @LastEditTime: 2023-07-17 18:53:14 * @FilePath: connection.go * @Description: 本地连接(逻辑上,并没有建立任何连接) * * Copyright (c) 2023 by duanzt, All Rights Reserved. |
remote
* @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:51 * @LastEditors: duanzt * @LastEditTime: 2023-07-17 13:12:18 * @FilePath: connection.go * @Description: 远程ssh连接 * * Copyright (c) 2023 by duanzt, All Rights Reserved. |
tools
* @Author: duanzt * @Date: 2023-07-14 18:21:26 * @LastEditors: duanzt * @LastEditTime: 2023-07-17 13:16:55 * @FilePath: filetools.go * @Description: 文件处理工具 * * Copyright (c) 2023 by duanzt, All Rights Reserved.
|
* @Author: duanzt * @Date: 2023-07-14 18:21:26 * @LastEditors: duanzt * @LastEditTime: 2023-07-17 13:16:55 * @FilePath: filetools.go * @Description: 文件处理工具 * * Copyright (c) 2023 by duanzt, All Rights Reserved. |
unit
|
|
example/localfile
* @Author: duanzt * @Date: 2023-07-17 12:30:24 * @LastEditors: duanzt * @LastEditTime: 2023-07-17 16:07:59 * @FilePath: main.go * @Description: 本地连接操作文件的使用示例 * * Copyright (c) 2023 by duanzt, All Rights Reserved.
|
* @Author: duanzt * @Date: 2023-07-17 12:30:24 * @LastEditors: duanzt * @LastEditTime: 2023-07-17 16:07:59 * @FilePath: main.go * @Description: 本地连接操作文件的使用示例 * * Copyright (c) 2023 by duanzt, All Rights Reserved. |
example/processon
* @Author: duanzt * @Date: 2023-07-17 12:23:38 * @LastEditors: duanzt * @LastEditTime: 2023-07-17 12:43:27 * @FilePath: main.go * @Description: 进度条的使用示例 * * Copyright (c) 2023 by duanzt, All Rights Reserved.
|
* @Author: duanzt * @Date: 2023-07-17 12:23:38 * @LastEditors: duanzt * @LastEditTime: 2023-07-17 12:43:27 * @FilePath: main.go * @Description: 进度条的使用示例 * * Copyright (c) 2023 by duanzt, All Rights Reserved. |
example/remotefile
* @Author: duanzt * @Date: 2023-07-17 16:04:32 * @LastEditors: duanzt * @LastEditTime: 2023-07-17 16:17:36 * @FilePath: main.go * @Description: 远程ssh连接操作文件的使用示例 * * Copyright (c) 2023 by duanzt, All Rights Reserved.
|
* @Author: duanzt * @Date: 2023-07-17 16:04:32 * @LastEditors: duanzt * @LastEditTime: 2023-07-17 16:17:36 * @FilePath: main.go * @Description: 远程ssh连接操作文件的使用示例 * * Copyright (c) 2023 by duanzt, All Rights Reserved. |