Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ page.on('request', async request => {
const proxy = 'https://user:pass@host:port';
```

Using socks authentication:
```js
const proxyOptions = {
protocol: 'socks5:',
auth: 'myUserName:p4$$w0rd',
host: '127.0.0.1',
port: 1080,
}
await useProxy(page, proxyOptions)
```
#### IP lookup:
```js
// 1. Waits until done, 'then' continues
Expand Down
4 changes: 2 additions & 2 deletions src/lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const setHeaders = (request) => {

// For applying proxy
const setAgent = (proxy) => {
if (proxy.startsWith("socks")) {
if (typeof proxy === 'object' || proxy.startsWith("socks")) {
return {
http: new SocksProxyAgent(proxy),
https: new SocksProxyAgent(proxy)
Expand All @@ -36,4 +36,4 @@ const setAgent = (proxy) => {
};
};

module.exports = {setHeaders, setAgent};
module.exports = {setHeaders, setAgent};