Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
E

easyssh-proxy

> 编程语言
Open source

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

348 stars0 likes1 views
WebsiteGitHub

About

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

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 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Gogolangproxysshssh-proxycommand

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

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