Eugene 1 год назад
Родитель
Сommit
581d7a66c3
3 измененных файлов с 21 добавлено и 18 удалено
  1. 1 1
      app/package.json
  2. 4 4
      app/yarn.lock
  3. 16 13
      tabby-ssh/src/session/ssh.ts

+ 1 - 1
app/package.json

@@ -30,7 +30,7 @@
     "native-process-working-directory": "^1.0.2",
     "npm": "6",
     "rxjs": "^7.5.7",
-    "russh": "^0.0.1-alpha.12",
+    "russh": "^0.0.1-alpha.13",
     "source-map-support": "^0.5.20",
     "v8-compile-cache": "^2.3.0",
     "yargs": "^17.7.2"

+ 4 - 4
app/yarn.lock

@@ -3613,10 +3613,10 @@ run-queue@^1.0.0, run-queue@^1.0.3:
   dependencies:
     aproba "^1.1.1"
 
-russh@^0.0.1-alpha.12:
-  version "0.0.1-alpha.12"
-  resolved "https://registry.yarnpkg.com/russh/-/russh-0.0.1-alpha.12.tgz#fc8d54870fef24ce8b5c33fb372199027c6572a2"
-  integrity sha512-nxfOSaa5V6+lutNwhLQuemIeAgzK8TXwOXcoEsvmd90dQ3TyrTUoNLOifbv5x0SYCg9dPRUP3OSwqnGPBhchug==
+russh@^0.0.1-alpha.13:
+  version "0.0.1-alpha.13"
+  resolved "https://registry.yarnpkg.com/russh/-/russh-0.0.1-alpha.13.tgz#51664cd13951647d9377091a91d6d7c4a53e657a"
+  integrity sha512-jWSOorimRb232xma0M8Dm8sdkhfK61D1VWtdycjihVbU4UnTI3M1BMNGt9hyJAy1+dmLjgzW8vpJVrNBI7EpOw==
   dependencies:
     "@napi-rs/cli" "^2.18.3"
 

+ 16 - 13
tabby-ssh/src/session/ssh.ts

@@ -254,6 +254,22 @@ export class SSHSession {
         } else if (this.jumpChannel) {
             transport = await russh.SshTransport.newSshChannel(await this.jumpChannel.take())
             this.jumpChannel = null
+        } else if (this.profile.options.socksProxyHost) {
+            this.emitServiceMessage(colors.bgBlue.black(' Proxy ') + ` Using ${this.profile.options.socksProxyHost}:${this.profile.options.socksProxyPort}`)
+            transport = await russh.SshTransport.newSocksProxy(
+                this.profile.options.socksProxyHost,
+                this.profile.options.socksProxyPort ?? 1080,
+                this.profile.options.host,
+                this.profile.options.port ?? 22,
+            )
+        } else if (this.profile.options.httpProxyHost) {
+            this.emitServiceMessage(colors.bgBlue.black(' Proxy ') + ` Using ${this.profile.options.httpProxyHost}:${this.profile.options.httpProxyPort}`)
+            transport = await russh.SshTransport.newHttpProxy(
+                this.profile.options.httpProxyHost,
+                this.profile.options.httpProxyPort ?? 8080,
+                this.profile.options.host,
+                this.profile.options.port ?? 22,
+            )
         } else {
             transport = await russh.SshTransport.newSocket(`${this.profile.options.host.trim()}:${this.profile.options.port ?? 22}`)
         }
@@ -329,19 +345,6 @@ export class SSHSession {
         }
 
         try {
-            // if (this.profile.options.socksProxyHost) {
-            //     this.emitServiceMessage(colors.bgBlue.black(' Proxy ') + ` Using ${this.profile.options.socksProxyHost}:${this.profile.options.socksProxyPort}`)
-            //     this.proxyCommandStream = new SocksProxyStream(this.profile)
-            // }
-            // if (this.profile.options.httpProxyHost) {
-            //     this.emitServiceMessage(colors.bgBlue.black(' Proxy ') + ` Using ${this.profile.options.httpProxyHost}:${this.profile.options.httpProxyPort}`)
-            //     this.proxyCommandStream = new HTTPProxyStream(this.profile)
-            // }
-
-            //     await this.proxyCommandStream.start()
-            // }
-
-
             // ssh.connect({
             //     keepaliveInterval: this.profile.options.keepaliveInterval ?? 15000,
             //     keepaliveCountMax: this.profile.options.keepaliveCountMax,