All Projects → delvedor → hpagent

delvedor / hpagent

Licence: MIT License
A ready to use http and https agent for working with proxies that keeps connections alive!

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to hpagent

Http2 Wrapper
Use HTTP2 the same way like HTTP1
Stars: ✭ 183 (+112.79%)
Mutual labels:  agent, https
ssrf-agent
make http(s) request to prevent SSRF
Stars: ✭ 16 (-81.4%)
Mutual labels:  agent, https
SecureFiware
Proposing security measures and security analysis in the Fiware IoT environment.
Stars: ✭ 21 (-75.58%)
Mutual labels:  https
django-yadpt-starter
Yet Another Django Project Template skeleton for Django projects
Stars: ✭ 28 (-67.44%)
Mutual labels:  https
bee-apm
BeeAPM is a distributed tracing system and APM ( Application Performance Monitoring )
Stars: ✭ 137 (+59.3%)
Mutual labels:  agent
agent
Store sensitive data such as API tokens
Stars: ✭ 19 (-77.91%)
Mutual labels:  agent
nomad-plugin
Nomad cloud plugin for Jenkins
Stars: ✭ 53 (-38.37%)
Mutual labels:  agent
zenit
Zenit is a daemon collector for metrics and log parsers for any MySQL variant and ProxySQL
Stars: ✭ 24 (-72.09%)
Mutual labels:  agent
HAProxy-2-RPM-builder
Build latest HAProxy binary with prometheus metrics support
Stars: ✭ 28 (-67.44%)
Mutual labels:  https
concerto
A command line tool and a library to generate TLS certificates for development purposes.
Stars: ✭ 34 (-60.47%)
Mutual labels:  https
flareon
🦊A cloudflare DNS over HTTPs resolver client library.
Stars: ✭ 14 (-83.72%)
Mutual labels:  https
plex-traefik
Plex media server with traefik 2 in docker and docker-compose
Stars: ✭ 30 (-65.12%)
Mutual labels:  https
lambda-redirector
Redirect an entire website using AWS Lambda
Stars: ✭ 21 (-75.58%)
Mutual labels:  https
macos
macOS load bootup and optimization
Stars: ✭ 29 (-66.28%)
Mutual labels:  agent
jota-cert-checker
Check SSL certificate expiration date of a list of sites.
Stars: ✭ 45 (-47.67%)
Mutual labels:  https
Stubmatic
Mock HTTP calls without coding. Designed specially for testing and testers.
Stars: ✭ 118 (+37.21%)
Mutual labels:  https
go-simple-mail
Golang package for send email. Support keep alive connection, TLS and SSL. Easy for bulk SMTP.
Stars: ✭ 298 (+246.51%)
Mutual labels:  keep-alive
javametrics
Application Metrics for Java™ instruments the Java runtime for performance monitoring, providing the monitoring data visually with its built in dashboard
Stars: ✭ 19 (-77.91%)
Mutual labels:  agent
AgentBaker
Agent Baker is aiming to provide a centralized, portable k8s agent node provisioning lib as well as rich support on different OS image with optimized k8s binaries.
Stars: ✭ 45 (-47.67%)
Mutual labels:  agent
simple-proxy-agent
Simple agent for sending HTTP and HTTPS traffic through HTTP and SOCKS proxies
Stars: ✭ 20 (-76.74%)
Mutual labels:  agent

hpagent

js-standard-style build

A ready to use http and https agent for working with proxies that keeps connections alive!

Install

npm install hpagent

Usage

Based on your infrastructure, you should use the http agent or the https agent. The following table will help you picking the right one.

Type Proxy Server
HttpProxyAgent HTTP HTTP
HttpProxyAgent HTTPS HTTP
HttpsProxyAgent HTTP HTTPS
HttpsProxyAgent HTTPS HTTPS
const { HttpProxyAgent, HttpsProxyAgent } = require('hpagent')

Once you have understood the right agent for your use case, you can instance it. It takes the same parameter of the Node.js core's http(s) agent and an additional proxy option, which is the url of your proxy.

const http = require('http')
const { HttpProxyAgent } = require('hpagent')

const agent = new HttpProxyAgent({
  keepAlive: true,
  keepAliveMsecs: 1000,
  maxSockets: 256,
  maxFreeSockets: 256,
  proxy: 'http://localhost:8080'
})

http.get('http://localhost:9200', { agent })
    .on('response', console.log)
    .end()

If your proxy requires basic authentication, you can configure it in the proxy url:

const http = require('http')
const { HttpProxyAgent } = require('hpagent')

const agent = new HttpProxyAgent({
  keepAlive: true,
  keepAliveMsecs: 1000,
  maxSockets: 256,
  maxFreeSockets: 256,
  proxy: 'http://user:pwd@localhost:8080'
})

http.get('http://localhost:9200', { agent })
    .on('response', console.log)
    .end()

Integrations

Following you can find the list of userland http libraries that are tested with this agent.

got

got('http://localhost:9200', {
  agent: {
    http: new HttpProxyAgent({
      keepAlive: true,
      keepAliveMsecs: 1000,
      maxSockets: 256,
      maxFreeSockets: 256,
      scheduling: 'lifo',
      proxy: 'http://localhost:8080'
    })
  }
})

needle

needle('get', 'http://localhost:9200', {
  agent: new HttpProxyAgent({
    keepAlive: true,
    keepAliveMsecs: 1000,
    maxSockets: 256,
    maxFreeSockets: 256,
    scheduling: 'lifo',
    proxy: 'http://localhost:8080'
  })
})

node-fetch

fetch('http://localhost:9200', {
  agent: new HttpProxyAgent({
    keepAlive: true,
    keepAliveMsecs: 1000,
    maxSockets: 256,
    maxFreeSockets: 256,
    scheduling: 'lifo',
    proxy: 'http://localhost:8080'
  })
})

simple-get

sget.concat({
  url: `http://${server.address().address}:${server.address().port}`,
  agent: new HttpProxyAgent({
    keepAlive: true,
    keepAliveMsecs: 1000,
    maxSockets: 256,
    maxFreeSockets: 256,
    scheduling: 'lifo',
    proxy: `https://${proxy.address().address}:${proxy.address().port}`
  })
}, function (err, response, data) {
  // handle the response
})

License

This software is licensed under the MIT.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].