From 59b7dae6f7b47d1ef13082e3caa5434360ec9870 Mon Sep 17 00:00:00 2001 From: Anna Bartel Date: Sun, 22 Aug 2021 12:25:41 +0200 Subject: [PATCH] Stop recommending `tunnel` package (#1851) --- documentation/tips.md | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/documentation/tips.md b/documentation/tips.md index 94e9cd9..261740c 100644 --- a/documentation/tips.md +++ b/documentation/tips.md @@ -154,24 +154,14 @@ scope.persist(false); ### Proxying -You can use the [`tunnel`](https://github.com/koichik/node-tunnel) package with the `agent` option to work with proxies: - -```js -import got from 'got'; -import tunnel from 'tunnel'; +**Note:** +> - The popular [`tunnel`](https://www.npmjs.com/package/tunnel) package is unmaintained. Use at your own risk. +> - The [`proxy-agent`](https://www.npmjs.com/package/proxy-agent) family doesn't follow newest Node.js features and lacks support. -await got('https://sindresorhus.com', { - agent: { - https: tunnel.httpsOverHttp({ - proxy: { - host: 'localhost' - } - }) - } -}); -``` +Although there isn't a perfect, bug-free package, [Apify](https://apify.com/)'s solution is a modern one.\ +See [`got-scraping/src/agent/h1-proxy-agent.ts`](https://github.com/apify/got-scraping/blob/2ec7f9148917a6a38d6d1c8c695606767c46cce5/src/agent/h1-proxy-agent.ts). It has the same API as `hpagent`. -Otherwise, you can use the [`hpagent`](https://github.com/delvedor/hpagent) package, which keeps the internal sockets alive to be reused. +[`hpagent`](https://github.com/delvedor/hpagent) is a modern package as well. In contrast to `tunnel`, it allows keeping the internal sockets alive to be reused. ```js import got from 'got';