Skip to content
This repository was archived by the owner on May 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #51 from train255/feature/socks-timeout-setting
Browse files Browse the repository at this point in the history
Set timeout to SocksClientOptions
  • Loading branch information
Kikobeats authored Jun 8, 2021
2 parents a2547a4 + b3d16f1 commit 2389a7d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default class SocksProxyAgent extends Agent {
opts: RequestOptions
): Promise<net.Socket> {
const { lookup, proxy } = this;
let { host, port } = opts;
let { host, port, timeout } = opts;

if (!host) {
throw new Error('No `host` defined!');
Expand All @@ -160,7 +160,8 @@ export default class SocksProxyAgent extends Agent {
const socksOpts: SocksClientOptions = {
proxy,
destination: { host, port },
command: 'connect'
command: 'connect',
timeout: timeout
};
debug('Creating socks proxy connection: %o', socksOpts);
const { socket } = await SocksClient.createConnection(socksOpts);
Expand Down

0 comments on commit 2389a7d

Please # to comment.