Merge pull request #932 from AhmedMondo/main
chore: downgrade proxy-agent to version 5
This commit is contained in:
commit
14564a6e02
@ -1024,7 +1024,7 @@ class Client extends BaseClient {
|
|||||||
typeof options.proxy === 'string' &&
|
typeof options.proxy === 'string' &&
|
||||||
testImportModule('proxy-agent') === false
|
testImportModule('proxy-agent') === false
|
||||||
) {
|
) {
|
||||||
throw new Error('MISSING_MODULE', 'proxy-agent', 'npm install proxy-agent');
|
throw new Error('MISSING_MODULE', 'proxy-agent', 'npm install proxy-agent@5');
|
||||||
}
|
}
|
||||||
if (typeof options.shardCount !== 'number' || isNaN(options.shardCount) || options.shardCount < 1) {
|
if (typeof options.shardCount !== 'number' || isNaN(options.shardCount) || options.shardCount < 1) {
|
||||||
throw new TypeError('CLIENT_INVALID_OPTION', 'shardCount', 'a number greater than or equal to 1');
|
throw new TypeError('CLIENT_INVALID_OPTION', 'shardCount', 'a number greater than or equal to 1');
|
||||||
|
@ -280,8 +280,8 @@ class WebSocketShard extends EventEmitter {
|
|||||||
|
|
||||||
let args = { handshakeTimeout: 30_000 };
|
let args = { handshakeTimeout: 30_000 };
|
||||||
if (client.options.proxy.length > 0) {
|
if (client.options.proxy.length > 0) {
|
||||||
const proxy = require('proxy-agent');
|
const ProxyAgent = require('proxy-agent');
|
||||||
args.agent = new proxy.ProxyAgent(client.options.proxy);
|
args.agent = new ProxyAgent(client.options.proxy);
|
||||||
this.debug(`Using proxy ${client.options.proxy}`, args);
|
this.debug(`Using proxy ${client.options.proxy}`, args);
|
||||||
}
|
}
|
||||||
// Adding a handshake timeout to just make sure no zombie connection appears.
|
// Adding a handshake timeout to just make sure no zombie connection appears.
|
||||||
|
@ -35,8 +35,8 @@ class APIRequest {
|
|||||||
make(captchaKey = undefined, captchaRqtoken = undefined) {
|
make(captchaKey = undefined, captchaRqtoken = undefined) {
|
||||||
if (agent === null) {
|
if (agent === null) {
|
||||||
if (typeof this.client.options.proxy === 'string' && this.client.options.proxy.length > 0) {
|
if (typeof this.client.options.proxy === 'string' && this.client.options.proxy.length > 0) {
|
||||||
const proxy = require('proxy-agent');
|
const ProxyAgent = require('proxy-agent');
|
||||||
agent = new proxy.ProxyAgent(this.client.options.proxy);
|
agent = new ProxyAgent(this.client.options.proxy);
|
||||||
} else if (this.client.options.http.agent instanceof https.Agent) {
|
} else if (this.client.options.http.agent instanceof https.Agent) {
|
||||||
agent = this.client.options.http.agent;
|
agent = this.client.options.http.agent;
|
||||||
agent.keepAlive = true;
|
agent.keepAlive = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user