Socket
Socket
Sign inDemoInstall

axios-socks5-agent

Package Overview
Dependencies
7
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    axios-socks5-agent

> npm i axios-socks5-agent


Version published
Weekly downloads
247
decreased by-17.11%
Maintainers
1
Install size
1.51 MB
Created
Weekly downloads
 

Readme

Source

axios-socks5-agent

npm i axios-socks5-agent

wrap for socks5-http-client and socks5-https-client. I wrote this because there is no module support socks5 for axios and allow modifying agentOptions (sth likes keepAlive)

const axios = require('axios')
const SocksAgent = require('axios-socks5-agent')

const { httpAgent, httpsAgent } = SocksAgent({
  agentOptions: {
    keepAlive: true,
  },
  // socks5
  host: '127.0.0.1',
  port: 9050,
  // socks5 auth
  username: 'admin',
  password: 'pass1234',
})

axios
  .get('http://wtfismyip.com/json', { httpAgent, httpsAgent })
  .then(res => console.log(res.data))
  .catch(e => console.error(e))

Usage

  • new Socks5Agent(options) => { httpAgent, httpsAgent }

    • options.host: socks5 host, default 127.0.0.1
    • options.port: socks5 port, default 9050
    • options.agentOptions: https.AgentOptions. For more details https://nodejs.org/api/https.html#https_new_agent_options
  • httpAgent vs httpsAgent: axios config

Keywords

FAQs

Last updated on 20 Dec 2021

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