Socket
Socket
Sign inDemoInstall

proxy-master

Package Overview
Dependencies
10
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    proxy-master

🌐 Proxy toolkit: parse, check, fetch from services


Version published
Maintainers
1
Created

Readme

Source

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)
  });
}

Keywords

FAQs

Last updated on 01 Feb 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc