Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tunnel-agent

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tunnel-agent

HTTP proxy tunneling agent. Formerly part of mikeal/request, now a standalone module.

  • 0.4.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
25M
increased by9.34%
Maintainers
4
Weekly downloads
 
Created

What is tunnel-agent?

The tunnel-agent npm package is used to implement HTTP/HTTPS tunneling. It allows you to proxy requests through a tunneling agent, which can be useful when you need to work with proxies or bypass network restrictions.

What are tunnel-agent's main functionalities?

HTTP Tunneling

This code sample demonstrates how to create an HTTP tunneling agent to proxy requests through a local proxy server running on port 8080.

const tunnel = require('tunnel-agent');
const https = require('https');

let tunnelingAgent = tunnel.httpOverHttp({
  proxy: {
    host: 'localhost',
    port: 8080
  }
});

const options = {
  host: 'example.com',
  port: 80,
  agent: tunnelingAgent
};

https.get(options, (res) => {
  console.log('Response:', res.statusCode);
});

HTTPS Tunneling

This code sample demonstrates how to create an HTTPS tunneling agent to proxy HTTPS requests through a local HTTPS proxy server running on port 8080.

const tunnel = require('tunnel-agent');
const https = require('https');

let tunnelingAgent = tunnel.httpsOverHttps({
  proxy: {
    host: 'localhost',
    port: 8080
  }
});

const options = {
  host: 'example.com',
  port: 443,
  agent: tunnelingAgent
};

https.get(options, (res) => {
  console.log('Response:', res.statusCode);
});

Other packages similar to tunnel-agent

FAQs

Package last updated on 04 May 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc