npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@tictactrip/luminator

v5.1.1

Published

Axios proxy provider agent.

Downloads

2,068

Readme

luminator

Dependencies Build License PRs Welcome

Description

This repository provides Axios proxy agents.

Install

yarn add @tictactrip/luminator

Available proxy providers

How to use it?

BrightData

Strategy: Manual

This kind of agent strategy allow to specifically set how and when a change of IP (through country) or sessionId is done.

Create your instance:

import { BrightData } from '@tictactrip/luminator';

const BrightData: BrightData = new BrightData({
    proxy: {
        username: 'tictactrip',
        password: 'secret',
        host: 'zproxy.lum-superproxy.io',
        port: 22225,
    }
});
  • Create an agent with a random countries and sessionId
const agent: BrightData =  BrightData.setIp();
  • Create an agent with a specific country and a random sessionId
const agent: BrightData = BrightData.setIp({ countries: [EBrightDataCountry.FRANCE] });
  • Create an agent with a specific country and a specific sessionId
const agent: BrightData = BrightData.setIp({ countries: [EBrightDataCountry.FRANCE], sessionId });
  • Create an agent with a random countries and a specific sessionId
const agent: BrightData = BrightData.setIp({ sessionId });

Strategy: Change IP every requests

This strategy aims to make a GET request with a FR or PT IP randomly every requests.

import { BrightData, EStrategyMode, EBrightDataCountry } from "@tictactrip/luminator";

const BrightData: BrightData = new BrightData({
    proxy: {
        username: 'tictactrip',
        password: 'secret',
        host: 'zproxy.lum-superproxy.io',
        port: 22225,
    },
    strategy: {
        mode: EStrategyMode.CHANGE_IP_EVERY_REQUESTS,
        countries: [EBrightDataCountry.FRANCE, EBrightDataCountry.SPAIN],
    },
});

const requestConfig = {
    method: 'get',
    baseURL: 'https://lumtest.com',
    url: '/myip.json',
}

const response1 = await BrightData.fetch(requestConfig);
const response2 = await BrightData.fetch(requestConfig);

console.log(response1.data);
console.log(response2.data);

Response:

{
  "ip": "184.174.62.231",
  "country": "FR",
  "asn": {
    "asnum": 9009,
    "org_name": "M247 Ltd"
  },
  "geo": {
    "city": "Paris",
    "region": "IDF",
    "region_name": "Île-de-France",
    "postal_code": "75014",
    "latitude": 48.8579,
    "longitude": 2.3491,
    "tz": "Europe/Paris",
    "lum_city": "paris",
    "lum_region": "idf"
  }
}
{
  "ip": "178.171.89.101",
  "country": "ES",
  "asn": {
    "asnum": 9009,
    "org_name": "M247 Ltd"
  },
  "geo": {
    "city": "Madrid",
    "region": "MD",
    "region_name": "Madrid",
    "postal_code": "28001",
    "latitude": 40.4167,
    "longitude": -3.6838,
    "tz": "Europe/Madrid",
    "lum_city": "madrid",
    "lum_region": "md"
  }
}

Shifter

Strategy: Manual

import { Shifter } from '@tictactrip/luminator';

const shifter: Shifter = new Shifter({
    proxy: {
        host: '76.34.12.53',
        port: 17664,
    },
    strategy: {
        mapping: {
            fr: [17643, 17644],
            es: [17645, 17646],
        },
    },
});
  • Create an agent using a random country
const agent: Shifter =  shifter.setIp();
  • Create an agent using a specific country
const agent: Shifter = shifter.setIp({ countries: [EShifterCountry.FRANCE] });

Strategy: Change IP every requests

import { Shifter, EStrategyMode, EShifterCountry } from "@tictactrip/luminator";

const shifter: Shifter = new Shifter({
    proxy: {
        host: '76.34.12.53',
        port: 17664,
    },
    strategy: {
        mode: EStrategyMode.CHANGE_IP_EVERY_REQUESTS,
        mapping: {
            fr: [17643, 17644],
            es: [17645, 17646],
        },
    },
});

const requestConfig = {
    method: 'get',
    baseURL: 'https://lumtest.com',
    url: '/myip.json',
}

const response1 = await shifter.fetch(requestConfig);
const response2 = await shifter.fetch(requestConfig);

console.log(response1.data);
console.log(response2.data);

Proxyrack

Strategy: Manual

import { Proxyrack } from '@tictactrip/luminator';

const proxyrack: Proxyrack = new Proxyrack({
    proxy: {
        username: "tictactrip",
        password: "secret",
        host: 'mixed.rotating.proxyrack.net',
        ports: [10000, 10001, 10002, 10003, 10004, 10005, 10006, 10007, 10008, 10009, 10010],
    },
    strategy: EStrategyMode.MANUAL,
});

const requestConfig = {
    method: 'get',
    baseURL: 'https://lumtest.com',
    url: '/myip.json',
}

const response1 = await proxyrack.fetch(requestConfig);
const response2 = await proxyrack.fetch(requestConfig);

// Change IP
proxyrack.setIp();

const response3 = await proxyrack.fetch(requestConfig);

console.log(response1.data);
console.log(response3.data);
console.log(response3.data)

Response:

{
  "ip": "184.174.62.231",
  "country": "FR",
  "asn": {
    "asnum": 9009,
    "org_name": "M247 Ltd"
  },
  "geo": {
    "city": "Paris",
    "region": "IDF",
    "region_name": "Île-de-France",
    "postal_code": "75014",
    "latitude": 48.8579,
    "longitude": 2.3491,
    "tz": "Europe/Paris",
    "lum_city": "paris",
    "lum_region": "idf"
  }
}
{
  "ip": "184.174.62.231",
  "country": "FR",
  "asn": {
    "asnum": 9009,
    "org_name": "M247 Ltd"
  },
  "geo": {
    "city": "Paris",
    "region": "IDF",
    "region_name": "Île-de-France",
    "postal_code": "75014",
    "latitude": 48.8579,
    "longitude": 2.3491,
    "tz": "Europe/Paris",
    "lum_city": "paris",
    "lum_region": "idf"
  }
}
{
  "ip": "178.171.89.101",
  "country": "ES",
  "asn": {
    "asnum": 9009,
    "org_name": "M247 Ltd"
  },
  "geo": {
    "city": "Madrid",
    "region": "MD",
    "region_name": "Madrid",
    "postal_code": "28001",
    "latitude": 40.4167,
    "longitude": -3.6838,
    "tz": "Europe/Madrid",
    "lum_city": "madrid",
    "lum_region": "md"
  }
}

Strategy: Change IP every requests

import { Shifter, EStrategyMode, EShifterCountry } from "@tictactrip/luminator";

const proxyrack: Proxyrack = new Proxyrack({
    proxy: {
        username: "tictactrip",
        password: "secret",
        host: 'megaproxy.rotating.proxyrack.net',
        port: 222,
    },
    strategy: EStrategyMode.CHANGE_IP_EVERY_REQUESTS,
});

const requestConfig = {
    method: 'get',
    baseURL: 'https://lumtest.com',
    url: '/myip.json',
}

const response1 = await shifter.fetch(requestConfig);
const response2 = await shifter.fetch(requestConfig);

console.log(response1.data);
console.log(response2.data);
{
  "ip": "184.174.62.231",
  "country": "FR",
  "asn": {
    "asnum": 9009,
    "org_name": "M247 Ltd"
  },
  "geo": {
    "city": "Paris",
    "region": "IDF",
    "region_name": "Île-de-France",
    "postal_code": "75014",
    "latitude": 48.8579,
    "longitude": 2.3491,
    "tz": "Europe/Paris",
    "lum_city": "paris",
    "lum_region": "idf"
  }
}
{
  "ip": "178.171.89.101",
  "country": "ES",
  "asn": {
    "asnum": 9009,
    "org_name": "M247 Ltd"
  },
  "geo": {
    "city": "Madrid",
    "region": "MD",
    "region_name": "Madrid",
    "postal_code": "28001",
    "latitude": 40.4167,
    "longitude": -3.6838,
    "tz": "Europe/Madrid",
    "lum_city": "madrid",
    "lum_region": "md"
  }
}

Scripts

Run using yarn run <script> command.

clean       - Remove temporarily folders.
build       - Compile source files.
build:watch - Interactive watch mode, compile sources on change.
lint        - Lint source files.
lint:fix    - Fix lint source files.
test        - Runs all tests with coverage.
test:watch  - Interactive watch mode, runs tests on change.

License

GPL-3.0 © Tictactrip