实现可运行的xterm.js方案

This commit is contained in:
dushixiang
2021-02-01 00:37:56 +08:00
committed by dushixiang
parent 86ef89ff21
commit 29fb520e48
11 changed files with 165 additions and 58 deletions

View File

@ -3,16 +3,28 @@ package global
import (
"github.com/gorilla/websocket"
"github.com/pkg/sftp"
"golang.org/x/crypto/ssh"
"next-terminal/pkg/guacd"
"sync"
)
type Tun struct {
Protocol string
Tunnel *guacd.Tunnel
SshClient *ssh.Client
SftpClient *sftp.Client
WebSocket *websocket.Conn
}
func (r *Tun) Close() {
if r.Protocol == "rdp" || r.Protocol == "vnc" {
_ = r.Tunnel.Close()
} else {
_ = r.SshClient.Close()
_ = r.SftpClient.Close()
}
}
type Observable struct {
Subject *Tun
Observers []Tun