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 = { const DEFAULT_CONFIG: ConnectConfig = {
tryKeyboard: true, tryKeyboard: true,
keepaliveInterval: 30e3, keepaliveInterval: 30e3,
} };
function replaceVariables(string?: string) { function replaceVariables(string?: string) {
if (typeof string !== 'string') return string; if (typeof string !== 'string') return string;

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

Loading…
Cancel
Save