diff --git a/server/api/guacamole.go b/server/api/guacamole.go index fce46b8..bc7c2c9 100644 --- a/server/api/guacamole.go +++ b/server/api/guacamole.go @@ -308,6 +308,8 @@ func (api GuacamoleApi) setConfig(propertyMap map[string]string, s model.Session configuration.SetParameter(guacd.DisableOffscreenCaching, propertyMap[guacd.DisableOffscreenCaching]) configuration.SetParameter(guacd.ColorDepth, propertyMap[guacd.ColorDepth]) configuration.SetParameter(guacd.ForceLossless, propertyMap[guacd.ForceLossless]) + configuration.SetParameter(guacd.PreConnectionId, propertyMap[guacd.PreConnectionId]) + configuration.SetParameter(guacd.PreConnectionBlob, propertyMap[guacd.PreConnectionBlob]) case "ssh": if len(s.PrivateKey) > 0 && s.PrivateKey != "-" { configuration.SetParameter("username", s.Username) diff --git a/server/api/resource-sharer.go b/server/api/resource-sharer.go index 1e896a2..8fe7453 100644 --- a/server/api/resource-sharer.go +++ b/server/api/resource-sharer.go @@ -2,10 +2,10 @@ package api import ( "context" - "next-terminal/server/service" "next-terminal/server/dto" "next-terminal/server/repository" + "next-terminal/server/service" "github.com/labstack/echo/v4" ) diff --git a/server/constant/const.go b/server/constant/const.go index 7e90c97..e1015ed 100644 --- a/server/constant/const.go +++ b/server/constant/const.go @@ -81,7 +81,7 @@ const ( ) var SSHParameterNames = []string{guacd.FontName, guacd.FontSize, guacd.ColorScheme, guacd.Backspace, guacd.TerminalType, SshMode, SocksProxyEnable, SocksProxyHost, SocksProxyPort, SocksProxyUsername, SocksProxyPassword} -var RDPParameterNames = []string{guacd.Domain, guacd.RemoteApp, guacd.RemoteAppDir, guacd.RemoteAppArgs, guacd.EnableDrive, guacd.DrivePath, guacd.ColorDepth, guacd.ForceLossless} +var RDPParameterNames = []string{guacd.Domain, guacd.RemoteApp, guacd.RemoteAppDir, guacd.RemoteAppArgs, guacd.EnableDrive, guacd.DrivePath, guacd.ColorDepth, guacd.ForceLossless, guacd.PreConnectionId, guacd.PreConnectionBlob} var VNCParameterNames = []string{guacd.ColorDepth, guacd.Cursor, guacd.SwapRedBlue, guacd.DestHost, guacd.DestPort} var TelnetParameterNames = []string{guacd.FontName, guacd.FontSize, guacd.ColorScheme, guacd.Backspace, guacd.TerminalType, guacd.UsernameRegex, guacd.PasswordRegex, guacd.LoginSuccessRegex, guacd.LoginFailureRegex} var KubernetesParameterNames = []string{guacd.FontName, guacd.FontSize, guacd.ColorScheme, guacd.Backspace, guacd.TerminalType, guacd.Namespace, guacd.Pod, guacd.Container, guacd.UesSSL, guacd.ClientCert, guacd.ClientKey, guacd.CaCert, guacd.IgnoreCert} diff --git a/server/global/gateway/gateway.go b/server/global/gateway/gateway.go index 6f6839a..4a02edb 100644 --- a/server/global/gateway/gateway.go +++ b/server/global/gateway/gateway.go @@ -83,6 +83,9 @@ func (g *Gateway) OpenSshTunnel(id, ip string, port int) (exposedIP string, expo return "", 0, err } + // TODO debug + hostname = "0.0.0.0" + localAddr := fmt.Sprintf("%s:%d", hostname, localPort) listener, err := net.Listen("tcp", localAddr) if err != nil { @@ -91,8 +94,9 @@ func (g *Gateway) OpenSshTunnel(id, ip string, port int) (exposedIP string, expo ctx, cancel := context.WithCancel(context.Background()) tunnel := &Tunnel{ - ID: id, - LocalHost: hostname, + ID: id, + //LocalHost: hostname, + LocalHost: "docker.for.mac.host.internal", LocalPort: localPort, Gateway: g, RemoteHost: ip, diff --git a/server/guacd/guacd.go b/server/guacd/guacd.go index 416193b..656aa0f 100644 --- a/server/guacd/guacd.go +++ b/server/guacd/guacd.go @@ -20,6 +20,9 @@ const ( Backspace = "backspace" TerminalType = "terminal-type" + PreConnectionId = "preconnection-id" + PreConnectionBlob = "preconnection-blob" + EnableDrive = "enable-drive" DriveName = "drive-name" DrivePath = "drive-path" diff --git a/web/src/components/asset/Asset.js b/web/src/components/asset/Asset.js index 2918d43..6d77fc1 100644 --- a/web/src/components/asset/Asset.js +++ b/web/src/components/asset/Asset.js @@ -558,7 +558,7 @@ class Asset extends Component { const name = record['name']; const sshMode = record['sshMode']; let url = ''; - if (protocol === 'ssh' && sshMode === 'native') { + if (protocol === 'ssh' && (sshMode === 'native' || sshMode === 'naive')) { url = `#/term?assetId=${id}&assetName=${name}`; } else { url = `#/access?assetId=${id}&assetName=${name}&protocol=${protocol}`; diff --git a/web/src/components/asset/AssetModal.js b/web/src/components/asset/AssetModal.js index 427b6a0..1ffb257 100644 --- a/web/src/components/asset/AssetModal.js +++ b/web/src/components/asset/AssetModal.js @@ -339,7 +339,7 @@ const AssetModal = function ({title, visible, handleOk, handleCancel, confirmLoa