百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
E

easyssh-proxy

> 编程语言
开源

easyssh-proxy 在 Go 中提供了一些 SSH 协议功能的简单实现

348 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

easyssh-proxy 在 Go 中提供了一些 SSH 协议功能的简单实现

easyssh-proxy

繁體中文

easyssh-proxy provides a simple implementation of some SSH protocol features in Go.

Feature

This project is forked from easyssh but add some features as the following.

  • Support plain text of user private key.
  • Support key path of user private key.
  • Support Timeout for the TCP connection to establish.
  • Support SSH ProxyCommand.
bash
     +--------+       +----------+      +-----------+
     | Laptop |   | Jumphost |  | FooServer |
     +--------+       +----------+      +-----------+

                         OR

     +--------+       +----------+      +-----------+
     | Laptop |   | Firewall |  | FooServer |
     +--------+       +----------+      +-----------+
     192.168.1.5       121.1.2.3         10.10.29.68

Installation

bash
go get github.com/appleboy/easyssh-proxy

Requirements: Go 1.24 or higher

Usage

You can see detailed examples of the ssh, scp, Proxy, and stream commands inside the examples folder.

MakeConfig

All functionality provided by this package is accessed via methods of the MakeConfig struct.

go
  ssh := &easyssh.MakeConfig{
    User:    "drone-scp",
    Server:  "localhost",
    KeyPath: "./tests/.ssh/id_rsa",
    Port:    "22",
    Timeout: 60 * time.Second,
  }

  stdout, stderr, done, err := ssh.Run("ls -al", 60*time.Second)
  err = ssh.Scp("/root/source.csv", "/tmp/target.csv")
  stdoutChan, stderrChan, doneChan, errChan, err = ssh.Stream("for i in {1..5}; do echo ${i}; sleep 1; done; exit 2;", 60*time.Second)

MakeConfig takes in the following properties:

property description
user The SSH user to be logged in with
Server The IP or hostname pointing of the server
Key A string containing the private key to be used when making the connection
KeyPath The path pointing to the SSH key file to be used when making the connection
Port The port to use when connecting to the SSH daemon of the server
Protocol The tcp protocol to be used: "tcp", "tcp4" "tcp6"
Passphrase The Passphrase to unlock the provided SSH key (leave blank if no Passphrase is required)
Password The Password to use to login the specified user
Timeout The length of time to wait before timing out the request
Proxy An additional set of configuration params that will be used to SSH into an additional server via the server configured in this top-level block
Ciphers An array of ciphers (e.g. aes256-ctr) to enable for the SSH connection
KeyExchanges An array of key exchanges (e.g. ecdh-sha2-nistp384) to enable for the SSH connection
Fingerprint The expected fingerprint to be returned by the SSH server, results in a fingerprint error if they do not match
UseInsecureCipher Enables the use of insecure ciphers and key exchanges that are insecure and can lead to compromise, see ssh

NOTE: Please view the reference documentation for the most up to date properties of MakeConfig and DefaultConfig

ssh

See examples/ssh/ssh.go

…

scp

See examples/scp/scp.go

…

SSH ProxyCommand

See examples/proxy/proxy.go

go
  ssh := &easyssh.MakeConfig{
    User:    "drone-scp",
    Server:  "localhost",
    Port:    "22",
    KeyPath: "./tests/.ssh/id_rsa",
    Timeout: 60 * time.Second,
    Proxy: easyssh.DefaultConfig{
      User:    "drone-scp",
      Server:  "localhost",
      Port:    "22",
      KeyPath: "./tests/.ssh/id_rsa",
      Timeout: 60 * time.Second,
    },
  }

NOTE: Properties for the Proxy connection are not inherited from the Jumphost. You must explicitly specify them in the DefaultConfig struct.

e.g. A custom Timeout length must be specified for both the Jumphost (intermediary server) and the destination server.

SSH Stream Log

See examples/stream/stream.go

…

WriteFile

See examples/writeFile/writeFile.go

go
func (ssh_conf *MakeConfig) WriteFile(reader io.Reader, size int64, etargetFile string) error
…
property description
reader The io.reader who's contents will be read and saved to the server
size The number of bytes to be read from the io.reader
etargetFile The location on the server that the file will be written to

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Gogolangproxysshssh-proxycommand

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言