Index.js:
// Node.js CURL proxy example – Random country selection
// https://www.geosurf.com/resources/residential-ips-integration-guide
const request = require(‘request’)const gateways = require(‘./gateways’).gateways // or get the list via Geosurd residential IPs API call – https://api.client.geosurf.io/account/details/gateways
let countriesPorts = gateways.map(item => { return item.country_port})
let randomAddress = ‘gw1.geosurf.io:’ + countriesPorts[Math.floor(Math.random() * countriesPorts.length)]console.log(randomAddress)
// Use random address in your CURL request
Gateways.js:
module.exports = {module.exports = { ‘gateways’: [ { ‘cnt’: 6512, ‘ctr’: ‘IN’, ‘country_name’: ‘India’, ‘country_port’: 8099 }, { ‘cnt’: 2117, ‘ctr’: ‘DE’, ‘country_name’: ‘Germany’, ‘country_port’: 8080 }, { ‘cnt’: 1386, ‘ctr’: ‘FR’, ‘country_name’: ‘France’, ‘country_port’: 8072 }, { ‘cnt’: 1373, ‘ctr’: ‘US’, ‘country_name’: ‘United States’, ‘country_port’: 8230 }, { ‘cnt’: 1255, ‘ctr’: ‘BR’, ‘country_name’: ‘Brazil’, ‘country_port’: 8030 }, { ‘cnt’: 1154, ‘ctr’: ‘HU’, ‘country_name’: ‘Hungary’, ‘country_port’: 8097 }, { ‘cnt’: 1067, ‘ctr’: ‘IT’, ‘country_name’: ‘Italy’, ‘country_port’: 8106 }, { ‘cnt’: 977, ‘ctr’: ‘ES’, ‘country_name’: ‘Spain’, ‘country_port’: 8202 }, { ‘cnt’: 729, ‘ctr’: ‘AR’, ‘country_name’: ‘Argentina’, ‘country_port’: 8010 }, { ‘cnt’: 588, ‘ctr’: ‘TH’, ‘country_name’: ‘Thailand’, ‘country_port’: 8216 }, { ‘cnt’: 579, ‘ctr’: ‘VE’, ‘country_name’: ‘Venezuela’, ‘country_port’: 8236 }, { ‘cnt’: 460, ‘ctr’: ‘GB’, ‘country_name’: ‘United Kingdom’, ‘country_port’: 8229 }, { ‘cnt’: 454, ‘ctr’: ‘RO’, ‘country_name’: ‘Romania’, ‘country_port’: 8181 }, { ‘cnt’: 411, ‘ctr’: ‘MX’, ‘country_name’: ‘Mexico’, ‘country_port’: 8142 }, { ‘cnt’: 274, ‘ctr’: ‘CL’, ‘country_name’: ‘Chile’, ‘country_port’: 8043 }, { ‘cnt’: 270, ‘ctr’: ‘CO’, ‘country_name’: ‘Colombia’, ‘country_port’: 8047 }, { ‘cnt’: 210, ‘ctr’: ‘EC’, ‘country_name’: ‘Ecuador’, ‘country_port’: 8061 }, { ‘cnt’: 205, ‘ctr’: ‘PE’, ‘country_name’: ‘Peru’, ‘country_port’: 8173 }, { ‘cnt’: 188, ‘ctr’: ‘TW’, ‘country_name’: ‘Taiwan’, ‘country_port’: 8213 }, { ‘cnt’: 150, ‘ctr’: ‘TR’, ‘country_name’: ‘Turkey’, ‘country_port’: 8222 }, { ‘cnt’: 148, ‘ctr’: ‘JP’, ‘country_name’: ‘Japan’, ‘country_port’: 8110 }, { ‘cnt’: 124, ‘ctr’: ‘PH’, ‘country_name’: ‘Philippines’, ‘country_port’: 8174 }, { ‘cnt’: 123, ‘ctr’: ‘PL’, ‘country_name’: ‘Poland’, ‘country_port’: 8176 }, { ‘cnt’: 112, ‘ctr’: ‘RU’, ‘country_name’: ‘Russian Federation’, ‘country_port’: 8182 }, { ‘cnt’: 97, ‘ctr’: ‘VN’, ‘country_name’: ‘Vietnam’, ‘country_port’: 8237 }, { ‘cnt’: 91, ‘ctr’: ‘ID’, ‘country_name’: ‘Indonesia’, ‘country_port’: 8101 }, { ‘cnt’: 84, ‘ctr’: ‘SK’, ‘country_name’: ‘Slovakia’, ‘country_port’: 8196 }, { ‘cnt’: 81, ‘ctr’: ‘RS’, ‘country_name’: ‘Serbia’, ‘country_port’: 8192 }, { ‘cnt’: 81, ‘ctr’: ‘PT’, ‘country_name’: ‘Portugal’, ‘country_port’: 8177 }, { ‘cnt’: 76, ‘ctr’: ‘GR’, ‘country_name’: ‘Greece’, ‘country_port’: 8084 }, { ‘cnt’: 62, ‘ctr’: ‘HK’, ‘country_name’: ‘Hong Kong’, ‘country_port’: 8096 }, { ‘cnt’: 51, ‘ctr’: ‘MA’, ‘country_name’: ‘Morocco’, ‘country_port’: 8149 }, { ‘cnt’: 51, ‘ctr’: ‘UY’, ‘country_name’: ‘Uruguay’, ‘country_port’: 8232 }, { ‘cnt’: 47, ‘ctr’: ‘NL’, ‘country_name’: ‘Netherlands’, ‘country_port’: 8155 }, { ‘cnt’: 44, ‘ctr’: ‘KR’, ‘country_name’: ‘Korea, Republic of’, ‘country_port’: 8116 }, { ‘cnt’: 41, ‘ctr’: ‘PK’, ‘country_name’: ‘Pakistan’, ‘country_port’: 8167 }, { ‘cnt’: 40, ‘ctr’: ‘UA’, ‘country_name’: ‘Ukraine’, ‘country_port’: 8227 }, { ‘cnt’: 32, ‘ctr’: ‘IL’, ‘country_name’: ‘Israel’, ‘country_port’: 8105 }, { ‘cnt’: 29, ‘ctr’: ‘IR’, ‘country_name’: ‘Iran (Islamic Republic of)’, ‘country_port’: 8102 }, { ‘cnt’: 25, ‘ctr’: ‘SA’, ‘country_name’: ‘Saudi Arabia’, ‘country_port’: 8190 }, { ‘cnt’: 24, ‘ctr’: ‘MY’, ‘country_name’: ‘Malaysia’, ‘country_port’: 8133 }, { ‘cnt’: 23, ‘ctr’: ‘BG’, ‘country_name’: ‘Bulgaria’, ‘country_port’: 8033 }, { ‘cnt’: 23, ‘ctr’: ‘DZ’, ‘country_name’: ‘Algeria’, ‘country_port’: 8003 }, { ‘cnt’: 21, ‘ctr’: ‘CZ’, ‘country_name’: ‘Czech Republic’, ‘country_port’: 8055 }, { ‘cnt’: 19, ‘ctr’: ‘TN’, ‘country_name’: ‘Tunisia’, ‘country_port’: 8221 }, { ‘cnt’: 15, ‘ctr’: ‘PY’, ‘country_name’: ‘Paraguay’, ‘country_port’: 8172 }, { ‘cnt’: 15, ‘ctr’: ‘PS’, ‘country_name’: ‘Palestine’, ‘country_port’: 8169 }, { ‘cnt’: 14, ‘ctr’: ‘ET’, ‘country_name’: ‘Ethiopia’, ‘country_port’: 8067 }, { ‘cnt’: 14, ‘ctr’: ‘DK’, ‘country_name’: ‘Denmark’, ‘country_port’: 8056 }, { ‘cnt’: 14, ‘ctr’: ‘BE’, ‘country_name’: ‘Belgium’, ‘country_port’: 8021 }, { ‘cnt’: 12, ‘ctr’: ‘RE’, ‘country_name’: ‘Reunion’, ‘country_port’: 8180 }, { ‘cnt’: 12, ‘ctr’: ‘ZA’, ‘country_name’: ‘South Africa’, ‘country_port’: 8200 }, { ‘cnt’: 12, ‘ctr’: ‘AE’, ‘country_name’: ‘United Arab Emirates’, ‘country_port’: 8228 }, { ‘cnt’: 12, ‘ctr’: ‘AT’, ‘country_name’: ‘Austria’, ‘country_port’: 8014 }, { ‘cnt’: 11, ‘ctr’: ‘AU’, ‘country_name’: ‘Australia’, ‘country_port’: 8013 }, { ‘cnt’: 11, ‘ctr’: ‘SE’, ‘country_name’: ‘Sweden’, ‘country_port’: 8210 }, { ‘cnt’: 11, ‘ctr’: ‘EG’, ‘country_name’: ‘Egypt’, ‘country_port’: 8062 }, { ‘cnt’: 11, ‘ctr’: ‘DO’, ‘country_name’: ‘Dominican Republic’, ‘country_port’: 8059 }, { ‘cnt’: 10, ‘ctr’: ‘CN’, ‘country_name’: ‘China’, ‘country_port’: 8044 }, { ‘cnt’: 10, ‘ctr’: ‘LT’, ‘country_name’: ‘Lithuania’, ‘country_port’: 8127 }, { ‘cnt’: 10, ‘ctr’: ‘SG’, ‘country_name’: ‘Singapore’, ‘country_port’: 8195 }, { ‘cnt’: 10, ‘ctr’: ‘BA’, ‘country_name’: ‘Bosnia and Herzegovina’, ‘country_port’: 8027 }, { ‘cnt’: 9, ‘ctr’: ‘HR’, ‘country_name’: ‘Croatia (Hrvatska)’, ‘country_port’: 8052 }, { ‘cnt’: 9, ‘ctr’: ‘PA’, ‘country_name’: ‘Panama’, ‘country_port’: 8170 }, { ‘cnt’: 8, ‘ctr’: ‘NO’, ‘country_name’: ‘Norway’, ‘country_port’: 8165 }, { ‘cnt’: 8, ‘ctr’: ‘SD’, ‘country_name’: ‘Sudan’, ‘country_port’: 8206 }, { ‘cnt’: 6, ‘ctr’: ‘SI’, ‘country_name’: ‘Slovenia’, ‘country_port’: 8197 }, { ‘cnt’: 6, ‘ctr’: ‘CR’, ‘country_name’: ‘Costa Rica’, ‘country_port’: 8051 }, { ‘cnt’: 6, ‘ctr’: ‘BD’, ‘country_name’: ‘Bangladesh’, ‘country_port’: 8018 }, { ‘cnt’: 6, ‘ctr’: ‘CI’, ‘country_name’: ‘Ivory Coast’, ‘country_port’: 8107 }, { ‘cnt’: 6, ‘ctr’: ‘GE’, ‘country_name’: ‘Georgia’, ‘country_port’: 8079 }, { ‘cnt’: 6, ‘ctr’: ‘MD’, ‘country_name’: ‘Moldova, Republic of’, ‘country_port’: 8144 }, { ‘cnt’: 6, ‘ctr’: ‘OM’, ‘country_name’: ‘Oman’, ‘country_port’: 8166 }, { ‘cnt’: 6, ‘ctr’: ‘IQ’, ‘country_name’: ‘Iraq’, ‘country_port’: 8103 }, { ‘cnt’: 6, ‘ctr’: ‘SY’, ‘country_name’: ‘Syrian Arab Republic’, ‘country_port’: 8212 }, { ‘cnt’: 5, ‘ctr’: ‘MO’, ‘country_name’: ‘Macau’, ‘country_port’: 8129 }, { ‘cnt’: 5, ‘ctr’: ‘IE’, ‘country_name’: ‘Ireland’, ‘country_port’: 8104 }, { ‘cnt’: 5, ‘ctr’: ‘LY’, ‘country_name’: ‘Libyan Arab Jamahiriya’, ‘country_port’: 8125 }, { ‘cnt’: 4, ‘ctr’: ‘AO’, ‘country_name’: ‘Angola’, ‘country_port’: 8006 }, { ‘cnt’: 4, ‘ctr’: ‘MU’, ‘country_name’: ‘Mauritius’, ‘country_port’: 8140 }, { ‘cnt’: 4, ‘ctr’: ‘MK’, ‘country_name’: ‘Macedonia’, ‘country_port’: 8130 }, { ‘cnt’: 4, ‘ctr’: ‘LV’, ‘country_name’: ‘Latvia’, ‘country_port’: 8121 }, { ‘cnt’: 4, ‘ctr’: ‘SV’, ‘country_name’: ‘El Salvador’, ‘country_port’: 8063 }, { ‘cnt’: 4, ‘ctr’: ‘CA’, ‘country_name’: ‘Canada’, ‘country_port’: 8038 }, { ‘cnt’: 4, ‘ctr’: ‘QA’, ‘country_name’: ‘Qatar’, ‘country_port’: 8179 }, { ‘cnt’: 4, ‘ctr’: ‘SN’, ‘country_name’: ‘Senegal’, ‘country_port’: 8191 }, { ‘cnt’: 3, ‘ctr’: ‘NZ’, ‘country_name’: ‘New Zealand’, ‘country_port’: 8158 }, { ‘cnt’: 3, ‘ctr’: ‘GP’, ‘country_name’: ‘Guadeloupe’, ‘country_port’: 8087 }, { ‘cnt’: 3, ‘ctr’: ‘BH’, ‘country_name’: ‘Bahrain’, ‘country_port’: 8017 }, { ‘cnt’: 3, ‘ctr’: ‘KW’, ‘country_name’: ‘Kuwait’, ‘country_port’: 8118 }, { ‘cnt’: 3, ‘ctr’: ‘MN’, ‘country_name’: ‘Mongolia’, ‘country_port’: 8146 }, { ‘cnt’: 3, ‘ctr’: ‘KH’, ‘country_name’: ‘Cambodia’, ‘country_port’: 8036 }, { ‘cnt’: 3, ‘ctr’: ‘JM’, ‘country_name’: ‘Jamaica’, ‘country_port’: 8109 }, { ‘cnt’: 3, ‘ctr’: ‘ME’, ‘country_name’: ‘Montenegro’, ‘country_port’: 8147 }, { ‘cnt’: 3, ‘ctr’: ‘CH’, ‘country_name’: ‘Switzerland’, ‘country_port’: 8211 }, { ‘cnt’: 2, ‘ctr’: ‘KE’, ‘country_name’: ‘Kenya’, ‘country_port’: 8113 }, { ‘cnt’: 2, ‘ctr’: ‘LU’, ‘country_name’: ‘Luxembourg’, ‘country_port’: 8128 }, { ‘cnt’: 2, ‘ctr’: ‘CM’, ‘country_name’: ‘Cameroon’, ‘country_port’: 8037 }, { ‘cnt’: 2, ‘ctr’: ‘JO’, ‘country_name’: ‘Jordan’, ‘country_port’: 8111 }, { ‘cnt’: 2, ‘ctr’: ‘LB’, ‘country_name’: ‘Lebanon’, ‘country_port’: 8122 }, { ‘cnt’: 2, ‘ctr’: ‘MQ’, ‘country_name’: ‘Martinique’, ‘country_port’: 8138 }, { ‘cnt’: 2, ‘ctr’: ‘AZ’, ‘country_name’: ‘Azerbaijan’, ‘country_port’: 8015 }, { ‘cnt’: 2, ‘ctr’: ‘NC’, ‘country_name’: ‘New Caledonia’, ‘country_port’: 8157 }, { ‘cnt’: 2, ‘ctr’: ‘AM’, ‘country_name’: ‘Armenia’, ‘country_port’: 8011 }, { ‘cnt’: 2, ‘ctr’: ‘HN’, ‘country_name’: ‘Honduras’, ‘country_port’: 8095 }, { ‘cnt’: 2, ‘ctr’: ‘MT’, ‘country_name’: ‘Malta’, ‘country_port’: 8136 }, { ‘cnt’: 2, ‘ctr’: ‘NP’, ‘country_name’: ‘Nepal’, ‘country_port’: 8154 }, { ‘cnt’: 2, ‘ctr’: ‘GA’, ‘country_name’: ‘Gabon’, ‘country_port’: 8077 }, { ‘cnt’: 2, ‘ctr’: ‘GI’, ‘country_name’: ‘Gibraltar’, ‘country_port’: 8082 }, { ‘cnt’: 2, ‘ctr’: ‘KZ’, ‘country_name’: ‘Kazakhstan’, ‘country_port’: 8112 }, { ‘cnt’: 2, ‘ctr’: ‘AF’, ‘country_name’: ‘Afghanistan’, ‘country_port’: 8001 }, { ‘cnt’: 2, ‘ctr’: ‘CY’, ‘country_name’: ‘Cyprus’, ‘country_port’: 8054 } ]}