更换日志组件为logrus,修改资产的账号和密码不再为必填选项

This commit is contained in:
dushixiang
2020-12-27 21:44:40 +08:00
parent 20030dac7d
commit bbeed5344a
23 changed files with 183 additions and 90 deletions

View File

@ -1,21 +1,23 @@
package global
import (
"github.com/gorilla/websocket"
"github.com/pkg/sftp"
"next-terminal/pkg/guacd"
"sync"
)
type Tun struct {
Tun guacd.Tunnel
Tun *guacd.Tunnel
SftpClient *sftp.Client
WebSocket *websocket.Conn
}
type TunStore struct {
m sync.Map
}
func (s *TunStore) Set(k string, v Tun) {
func (s *TunStore) Set(k string, v *Tun) {
s.m.Store(k, v)
}
@ -23,10 +25,10 @@ func (s *TunStore) Del(k string) {
s.m.Delete(k)
}
func (s *TunStore) Get(k string) (item Tun, ok bool) {
func (s *TunStore) Get(k string) (item *Tun, ok bool) {
value, ok := s.m.Load(k)
if ok {
return value.(Tun), true
return value.(*Tun), true
}
return item, false
}