Skip to content

Commit 9972ba6

Browse files
authoredAug 22, 2021
Stop recommending tunnel package (sindresorhus#1851)
1 parent d5eb221 commit 9972ba6

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed
 

‎documentation/tips.md

+6-16
Original file line numberDiff line numberDiff line change
@@ -154,24 +154,14 @@ scope.persist(false);
154154

155155
### Proxying
156156

157-
You can use the [`tunnel`](https://github.com/koichik/node-tunnel) package with the `agent` option to work with proxies:
158-
159-
```js
160-
import got from 'got';
161-
import tunnel from 'tunnel';
157+
**Note:**
158+
> - The popular [`tunnel`](https://www.npmjs.com/package/tunnel) package is unmaintained. Use at your own risk.
159+
> - The [`proxy-agent`](https://www.npmjs.com/package/proxy-agent) family doesn't follow newest Node.js features and lacks support.
162160
163-
await got('https://sindresorhus.com', {
164-
agent: {
165-
https: tunnel.httpsOverHttp({
166-
proxy: {
167-
host: 'localhost'
168-
}
169-
})
170-
}
171-
});
172-
```
161+
Although there isn't a perfect, bug-free package, [Apify](https://apify.com/)'s solution is a modern one.\
162+
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`.
173163

174-
Otherwise, you can use the [`hpagent`](https://github.com/delvedor/hpagent) package, which keeps the internal sockets alive to be reused.
164+
[`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.
175165

176166
```js
177167
import got from 'got';

0 commit comments

Comments
 (0)
Please sign in to comment.