Skip to content

Commit

Permalink
Merge pull request #132 from csgofloat/feature/proxy-list
Browse files Browse the repository at this point in the history
Adds Proxy Rotating List Support
  • Loading branch information
Step7750 authored Apr 19, 2023
2 parents 23a8e35 + efd02c8 commit 4017044
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions config.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ module.exports = {
'auth': '2FA_TOKEN_2'
}
],
// Optional HTTP/SOCKS5 proxies to auto-rotate for each bot, each bot will have a random proxy
'proxies': [],
// Bot settings
'bot_settings': {
// Amount of attempts for each request to Valve
Expand Down
16 changes: 15 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,21 @@ if (args.steam_data) {
}

for (let loginData of CONFIG.logins) {
botController.addBot(loginData, CONFIG.bot_settings);
const settings = Object.assign({}, CONFIG.bot_settings);
if (CONFIG.proxies && CONFIG.proxies.length > 0) {
const proxy = CONFIG.proxies[Math.floor(Math.random() * CONFIG.proxies.length)];

if (proxy.startsWith('http://')) {
settings.steam_user = Object.assign({}, settings.steam_user, {httpProxy: proxy});
} else if (proxy.startsWith('socks5://')) {
settings.steam_user = Object.assign({}, settings.steam_user, {socksProxy: proxy});
} else {
console.log(`Invalid proxy '${proxy}' in config, must prefix with http:// or socks5://`);
process.exit(1);
}
}

botController.addBot(loginData, settings);
}

postgres.connect();
Expand Down

0 comments on commit 4017044

Please sign in to comment.