aiko-chan-ai / discord.js-selfbot-v13

An unofficial discord.js fork for creating selfbots
https://discordjs-self-v13.netlify.app
GNU General Public License v3.0
834 stars 172 forks source link

Add support for http/s proxies with auth #470

Closed DemonMartin closed 1 year ago

DemonMartin commented 1 year ago

Which package is the feature request for?

The core library

Feature

Add some kind of support for http/s proxies with username & password because "proxy-agent" does not support that based on their docs.

Ideal solution or implementation

Maybe using https://www.npmjs.com/package/https-proxy-agent or something like that

Alternative solutions or implementations

No response

Other context

No response

DemonMartin commented 1 year ago

I also get this error when trying to use IPRoyale's Socks5 proxies: FetchError: request to https://discord.com/api/v9/gateway failed, reason: Hostname/IP does not match certificate's altnames: IP: 162.xxx.xxx.xxx is not in the cert's list:

TheDevYellowy commented 1 year ago

what code did you run to get that error / how are you trying to implement the proxies?

DemonMartin commented 1 year ago

Basically what I was doing, is trying to use socks5 proxies with auth, meaning I added const client = new Client({ checkUpdate: true, proxy: "socks5://" + goodProxy, restRequestTimeout: 60 * 1000, interactionTimeout: 60 * 1000, restWsBridgeTimeout: 5 * 1000, captchaService: "2captcha", captchaKey: "xxxxxxxxxxxxxxxxxxxxxxx" }); goodProxy is just a "checker" for the proxy speed, since I'm using sticky proxies which last for 15 mins. My code only logs into the account for 1-3mins, so that shouldn't be a problem. The error appeared when executing client.login()

goodProxy returns something like this: name:password@geo.iproyal.com:port

TheDevYellowy commented 1 year ago

you can use https-proxy-agent and it would look something like this

const HttpsProxyAgent = require('https-proxy-agent');
var agent = HttpsProxyAgent('proxyHere');
const client = new Client({ checkUpdate: true, http: { agent: agent }, restRequestTimeout: 60 * 1000, interactionTimeout: 60 * 1000, restWsBridgeTimeout: 5 * 1000, captchaService: "2captcha", captchaKey: "xxxxxxxxxxxxxxxxxxxxxxx" });

you just change the proxy argument to http.agent argument and in theory this should work

aiko-chan-ai commented 1 year ago

I don't have a good proxy to check :c

DemonMartin commented 1 year ago

@aiko-chan-ai You could just buy some cheap proxy from for ex. iproyal (using coupon which gives ya 50% off) and test it :)

potnet commented 1 year ago

@aiko-chan-ai You could just buy some cheap proxy from for ex. iproyal (using coupon which gives ya 50% off) and test it :)

Or maybe you could buy a cheap socks5 proxy O_O