implement socks5 proxy measurement

This commit is contained in:
Bilal
2020-08-20 15:54:39 +03:00
parent ad42e25a25
commit 7adcbe3102
4 changed files with 57 additions and 27 deletions

View File

@@ -1,8 +1,8 @@
require('dotenv').config();
const http = require('http');
const { convertProxyListToString } = require('./helpers');
const { loadAllProxyServers, setTimeToFetch, sortProxyServers, selectBestProxies } = require('./proxyHelpers');
const { loadAllProxyServers, setTimeToFetch } = require('./proxyHelpers');
const { sortProxyServers, selectBestProxies, cleanProxyServers, convertProxyListToString } = require('./helpers');
let proxyServersObject = {
'https': [],
@@ -27,20 +27,25 @@ const handleHttpRequest = (req, res) => {
}
const refreshProxyList = async () => {
console.log(new Date(), 'Refreshing proxy list--------');
const fullProxyList = await loadAllProxyServers();
const httpsProxyList = fullProxyList['https'];
// const socks5ProxyList = fullProxyList['socks5'];
const socks5ProxyList = fullProxyList['socks5'];
const updatedHttpsProxyList = await setTimeToFetch(httpsProxyList);
// const updatedSocks5ProxyList = await setTimeToFetch(socks5ProxyList);
const updatedSocks5ProxyList = await setTimeToFetch(socks5ProxyList);
const sortedHttpsProxyList = sortProxyServers(updatedHttpsProxyList);
// const sortedSocks5ProxyList = sortProxyServers(updatedSocks5ProxyList);
const cleanUpdatedHttpsProxyList = cleanProxyServers(updatedHttpsProxyList);
const cleanUpdatedSocks5ProxyList = cleanProxyServers(updatedSocks5ProxyList);
const sortedHttpsProxyList = sortProxyServers(cleanUpdatedHttpsProxyList);
const sortedSocks5ProxyList = sortProxyServers(cleanUpdatedSocks5ProxyList);
proxyServersObject = {
'https': selectBestProxies(sortedHttpsProxyList),
// 'socks5': selectBestProxies(sortedSocks5ProxyList)
'socks5': selectBestProxies(sortedSocks5ProxyList)
}
console.log(new Date(), 'DONE----------------------', (process.memoryUsage()['rss'] / 1024 * 100) / 100, 'KiB');
}
(async () => {