Clean up some code

pull/84/head
Kelvin Schoofs 6 years ago
parent beb00d63c3
commit ee0041402e

@ -16,7 +16,7 @@ type SFTPWrapper = SFTPWrapperReal;
const DEFAULT_CONFIG: ConnectConfig = {
tryKeyboard: true,
keepaliveInterval: 30e3,
}
};
function replaceVariables(string?: string) {
if (typeof string !== 'string') return string;
@ -69,7 +69,7 @@ export async function calculateActualConfig(config: FileSystemConfig): Promise<F
port: session.proxyport,
type: session.proxymethod === 1 ? 'socks4' : (session.proxymethod === 2 ? 'socks5' : 'http'),
};
break;
break;
default:
throw new Error(`The requested PuTTY session uses an unsupported proxy method`);
}

@ -45,12 +45,12 @@ export function http(config: FileSystemConfig): Promise<NodeJS.ReadableStream> {
reject(new Error(`Expected config.proxy.type' to be 'http'`));
}
try {
let req = request({
const req = request({
port: config.proxy!.port,
hostname: config.proxy!.host,
method: 'CONNECT',
path: `${config.host}:${config.port}`
})
path: `${config.host}:${config.port}`,
});
req.end();
req.on('connect', (res, socket) => {
resolve(socket as NodeJS.ReadableStream);

Loading…
Cancel
Save