Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // import the required modules
- import got from 'got';
- import {HttpsProxyAgent} from 'hpagent';
- const proxyOptions = {
- agent: {
- // create a new HttpsProxyAgent instance
- https: new HttpsProxyAgent({
- // add proxy settings
- keepAlive: true,
- keepAliveMsecs: 1000,
- maxSockets: 256,
- maxFreeSockets: 256,
- scheduling: 'lifo',
- // specify proxy URL.
- proxy: 'http://20.219.180.149:3129'
- })
- }
- };
- try {
- // make HTTP request
- const {body} = await got('https://httpbin.io/ip', proxyOptions);
- // log the response
- console.log(body);
- } catch (error) {
- console.error(error);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement