From f943e50cbda13955b7ba62e18a5eb3544a127a65 Mon Sep 17 00:00:00 2001 From: McToel Date: Mon, 17 Feb 2025 15:46:01 +0100 Subject: [PATCH] cleanup --- lib/request.js | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) diff --git a/lib/request.js b/lib/request.js index e9a02b73..bb5441f2 100644 --- a/lib/request.js +++ b/lib/request.js @@ -3,56 +3,6 @@ import {Request, fetch} from 'cross-fetch'; import {parse as parseContentType} from 'content-type'; import {HafasError} from './errors.js'; -// const proxyAddress = process.env.HTTPS_PROXY || process.env.HTTP_PROXY || null; -// const localAddresses = process.env.LOCAL_ADDRESS || null; - -// if (proxyAddress && localAddresses) { -// console.error('Both env vars HTTPS_PROXY/HTTP_PROXY and LOCAL_ADDRESS are not supported.'); -// process.exit(1); -// } - -// const plainAgent = new HttpsAgent({ -// keepAlive: true, -// }); -// let getAgent = () => plainAgent; - -// if (proxyAddress) { -// const agent = new ProxyAgent(proxyAddress, { -// keepAlive: true, -// keepAliveMsecs: 10 * 1000, // 10s -// }); -// getAgent = () => agent; -// } else if (localAddresses) { -// const agents = process.env.LOCAL_ADDRESS.split(',') -// .map((addr) => { -// const family = isIP(addr); -// if (family === 0) { -// throw new Error('invalid local address:' + addr); -// } -// return new HttpsAgent({ -// localAddress: addr, family, -// keepAlive: true, -// }); -// }); -// const pool = roundRobin(agents); -// getAgent = () => pool.get(); -// } - -// const id = randomBytes(3) -// .toString('hex'); -// const randomizeUserAgent = (userAgent) => { -// let ua = userAgent; -// for ( -// let i = Math.round(5 + Math.random() * 5); -// i < ua.length; -// i += Math.round(5 + Math.random() * 5) -// ) { -// ua = ua.slice(0, i) + id + ua.slice(i); -// i += id.length; -// } -// return ua; -// }; - const randomBytesHex = (nBytes = 8) => { const array = new Uint8Array(nBytes); crypto.getRandomValues(array);