@coder/sshclient
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

sshclient · MIT license "Latest Release"

sshclient is a JavaScript library to process client SSH connections. It communicates with an OpenSSH server.

❤️ to gopherjs. sshclient uses the golang.org/x/crypto/ssh implementation. Currently the following functionality has been exposed from their API:

  • Port forwarding
  • PTYs
  • Exec

Usage

import * as sshclient from "@coder/sshclient"

// The server hosting this socket is serving sshd on
// port 22 from the host.
const socket = new WebSocket("ws://localhost:8080/ssh")
socket.binaryType = "arraybuffer"
socket.addEventListener("open", () => {
    const conn = sshclient.createConnection((data) => {
        socket.send(data)
    })

    socket.addEventListener("message", (event) => {
        conn.writeToClient(new Uint8Array(event.data))
    })

    sshclient.createClient(conn, {
        username: "kyle",
        password: "example",
    }).then((client) => {
        // 🎊
    })
})

Development

You must have gopherjs and Go 1.12.

yarn
yarn dev

Go source code will be transformed and hot-reloaded by Webpack via gopherjs-loader.js.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @coder/sshclient

Weekly Downloads

9

Version

0.1.0

License

MIT

Unpacked Size

2.66 MB

Total Files

5

Last publish

Collaborators

  • kiracoder
  • bruno.quaresma
  • coderhq
  • kylecarbs
  • coderasher
  • nhooyr
  • ammarb