https://github.com/qinghon/gossh
ssh to websocket, webssh backend
https://github.com/qinghon/gossh
go webssh xteamjs
Last synced: 12 months ago
JSON representation
ssh to websocket, webssh backend
- Host: GitHub
- URL: https://github.com/qinghon/gossh
- Owner: qinghon
- License: gpl-3.0
- Created: 2019-12-22T10:56:06.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-22T11:28:10.000Z (about 6 years ago)
- Last Synced: 2025-01-04T02:55:07.114Z (about 1 year ago)
- Topics: go, webssh, xteamjs
- Language: Go
- Size: 35.2 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gossh
ssh to websocket, webssh backend
通过websocket 转ssh 链接其他主机
Ssh via websocket to other hosts
做为webssh后端,需与xteam.js 配合使用
As a webssh backend, it needs to work with xteam.js
### Install xteam.js
```bash
npm install --save xterm.js
npm install --save xterm-addon-attach
```
### Use
```vue
import { AttachAddon } from 'xterm-addon-attach'
import { Terminal } from 'xterm'
import 'xterm/css/xterm.css'
export default {
name: 'CompTerm',
data () {
return {
isFullScreen: false,
searchKey: '',
v: false,
ws: null,
term: null,
hostname: '0.0.0.0',
Port: 22,
username: 'root',
password: '',
pri_key: '',
wsUrl: 'ws://127.0.0.1:9018/ws?' + 'cols=' + this.term.cols + '&rows=' + this.term.rows + '&hostname=' + this.hostname + '&port=' + this.Port + '&user=' + this.username + '&pd=' + this.password + '&pk=' + this.pri_key
}
}
this.term = new Terminal({
rows: 35,
fontSize: 18,
cursorBlink: true,
cursorStyle: 'bar',
bellStyle: 'sound',
theme: defaultTheme
})
this.term.open(this.$refs.terminal)
this.ws = new WebSocket(this.wsUrl)
const attachAddon = new AttachAddon(this.ws)
this.term.loadAddon(attachAddon)
```
## parameter
```golang
Hostname string `form:"hostname" json:"hostname" binding:"required"`
Port string `form:"port,default=22" json:"port" `
User string `form:"user,default=root" json:"user"`
Password string `form:"pd" json:"password"` //base64 encoded password
Cols int `form:"cols,default=120" json:"cols"`
Rows int `form:"rows,default=32" json:"rows"`
PriKey string `form:"pk" json:"pri_key"` //base64 private key
```
## Build
```bash
go build
```