From 3b7f6ad7ca249de6f443f804e178a1892df18054 Mon Sep 17 00:00:00 2001 From: Kelvin Schoofs Date: Sun, 13 May 2018 16:09:58 +0200 Subject: [PATCH] Fetch proxy settings from PuTTY sessions --- src/manager.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/manager.ts b/src/manager.ts index beff0f2..5c0e721 100644 --- a/src/manager.ts +++ b/src/manager.ts @@ -201,7 +201,22 @@ export class Manager implements vscode.FileSystemProvider, vscode.TreeDataProvid return reject(new Error(`Error while reading the keyfile at:\n${session.publickeyfile}`)); } } + switch (session.proxymethod) { + case 0: + break; + case 1: + case 2: + if (!session.proxyhost) return reject(new Error(`Proxymethod is SOCKS 4/5 but 'proxyhost' is missing`)); + config.proxy = { + host: session.proxyhost, + port: session.proxyport, + type: session.proxymethod === 1 ? 'socks4' : 'socks5', + }; + break; + default: + return reject(new Error(`The requested PuTTY session uses an unsupported proxy method`)); } + } if (!config.username || (config.username as any) === true) { config.username = await vscode.window.showInputBox({ ignoreFocusOut: true,