3

用go+xtermjs实现的一个webssh的demo

 1 year ago
source link: https://studygolang.com/articles/36145
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

用go+xtermjs实现的一个webssh的demo

rushui · 大约10小时之前 · 178 次点击 · 预计阅读时间 1 分钟 · 大约8小时之前 开始浏览    

一个简单的web应用程序demo,用作连接到ssh服务器的ssh客户端。它是用go+xterm.js编写的。

本项目只是一个demo,只做参考用,后续会写一个正式版本,敬请期待!

模块交互图

模块交互图

使用xterm.js实现 demo版本只用了简单的html,达到效果就OK

前端有个FitAddon插件,在html版本上用了,后面还是用vue+xterm.js实现前端吧。

从交互图上可以看出,项目有两大功能,一个是ssh交互,一个是回放。在ssh通讯的过程中,交互的数据会被保存下来,这一步要录屏。

websocket

前端ui与ssh服务器通讯的桥梁,

terminal

封装各种shell的控制台。包含本地shell、远程ssh和k8s中pod的shell

replay

包含录屏与回放两种功能。

SSH服务器

输入下面命令建立一个ssh服务器,本demo提供了这个模拟ssh服务的默认参数,开箱即用。

docker run -d -p 222:22 --rm bimg/alpine-ssh

ssh服务项目地址: https://github.com/basicimage/alpine-ssh

效果

https://github.com/go-webssh/demo


有疑问加站长微信联系(非本文作者))

280

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK