1.5.5 • Published 3 months ago

proxy-master v1.5.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Proxy Master

Node.JS proxy toolkit: Fetch, check, connect

Test Status Downloads last commit codecov GitHub proxy-master Known Vulnerabilities Quality npm license MIT Size

📦 Installation

  • Using npm
    npm i proxy-master
  • Using Yarn
    yarn add proxy-master
  • Using pnpm
    pnpm add proxy-master

⚙️ Usage

import { fetchers, getAgent, isSocks, getDispatcher } from "proxy-master";

const fetcher = fetchers.combine({
  fetchers: [
    fetchers.file({ path: "./proxy.txt" }),

    // Get some free ones from github
    fetchers.file({ path: "https://raw.githubusercontent.com/proxifly/free-proxy-list/main/proxies/all/data.txt" }),
    fetchers.file({ path: "https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/http.txt", defaultProxyType: "http" }),
    fetchers.file({ path: "https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/socks4.txt", defaultProxyType: "socks4" }),
    fetchers.file({ path: "https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/socks5.txt", defaultProxyType: "socks5" }),
  ]
});

// fetch proxies initially
await fetcher.fetch();

// refetch every 5 minutes
fetcher.refetchOnInterval(300_000);

// get random proxy
const proxy = fetcher.random();

// create custom agent
const agent = getAgent(proxy);

{
  // fetch with native (node.js fetch/undici)
  await fetch("https://example.com", { dispatcher: getDispatcher(proxy) })
}

{
  // fetch directly (node-fetch)
  await fetch("https://example.com", { agent });
}

{
  // create new vk
  const vk = new VK({ agent });
}

{
  // use in minecraft bot
  // minecraft protocol is TCP based, to http proxies don't work

  if (!isSocks(proxy)) {
    return;
  }

  const bot = mineflayer.createBot({
    stream: await createSocksSocket(proxy, "play.dicraft.net", 25565)
  });
}
1.5.5

3 months ago

1.5.4

6 months ago

1.5.3

6 months ago

1.5.2

6 months ago

1.5.1

6 months ago

1.5.0

6 months ago

1.4.0

6 months ago

1.3.1

6 months ago

1.3.0

6 months ago

1.2.1

6 months ago

1.2.0

6 months ago

1.1.1

6 months ago

1.1.0

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago