@coder/sshclient
v0.1.0
Published
A JavaScript library to process client SSH connections. It communicates with an OpenSSH server.
Downloads
8
Keywords
Readme
sshclient ·
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
.