diff --git a/config.example.js b/config.example.js index b6447f2..cd5f5b9 100644 --- a/config.example.js +++ b/config.example.js @@ -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 diff --git a/index.js b/index.js index fb38264..1913944 100644 --- a/index.js +++ b/index.js @@ -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();