npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@journeyapps/https-proxy-socket

v1.0.0

Published

Node library to enable opening Socket connections via an HTTPS proxy.

Downloads

4,732

Readme

https-proxy-socket

Node library to enable opening Socket connections via an HTTPS proxy.

Based on the implementation in https://github.com/TooTallNate/node-https-proxy-agent, but adapted to expose raw Sockets, instead of just http/https requests.

Proxy for Node mssql (tedious)

The useProxyForTedious has been removed, if you require this functionality please use v0.2.2 instead.

Installation

yarn add @journeyapps/https-proxy-socket
npm install @journeyapps/https-proxy-socket
pnpm add @journeyapps/https-proxy-socket

Usage - node-fetch

import { HttpsProxySocket } from '@journeyapps/https-proxy-socket';
import fetch from 'node-fetch';

/** Proxy connection options */
const proxy = new HttpsProxySocket('https://my-proxy.test', {
  /** Proxy auth and headers may be set here, for example: */
  auth: 'myuser:mypassword', // Basic auth
});

const agent = proxy.agent({
  /**
   * Additional TLS options for the host may be set here, for example:
   * rejectUnauthorized: false, // Disable TLS checks completely (dangerous)
   * ca: fs.readFileSync('my-ca-cert.pem') // Use a custom CA cert
   *
   * Documentation of the available options is available here:
   * https://nodejs.org/api/tls.html#tls_new_tls_tlssocket_socket_options
   * https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options
   */
});

const response = await fetch('https://myhost.test', { agent: agent });

Usage - Direct socket

import { HttpsProxySocket } from '@journeyapps/https-proxy-socket';
const proxy = new HttpsProxySocket('https://my-proxy.test');

const socket = await proxy.connect({ host: 'myhost.test', port: 1234 });

Usage - MongoDB

The socks package needs to be added to your package.json dependencies for this to work. See the MongoDB documentation for details: https://www.mongodb.com/docs/drivers/node/current/security/socks/


import * as mongo from 'mongodb';
import { useProxyForMongo } from '@journeyapps/https-proxy-socket';

const SRV_URI = 'mongodb+srv://<username>:<password>@cluster0.jzuewet.mongodb.net';
const PROXY = 'us-cc-proxy.journeyapps.com'; // Or za-cc-proxy.journeyapps.com
const PROXY_PORT = 443

/**
 * Register the proxy globally for MongoDB
 * This retuens a close function to end the socket
 */
const { close } = useProxyForMongo({
  proxy: PROXY,
  auth: <egress_token> // See JourneyApps MongoDB Token section below
});

async function run() {
  const client = new mongo.MongoClient(SRV_URI, {
    proxyPort: PROXY_PORT,
    proxyHost: PROXY,
  });
  try {
    const database = client.db('poc');
    const data = database.collection('data');

    const results = await data.find({ index: { $lt: 5 } }).toArray();
    console.log(results);
  } finally {
    close()
    await client.close();
  }
}

run().catch(console.error);

JourneyApps MongoDB Token

Using Mongo Atlas usually means the connection is a SRV string. Under the hood Mongo driver converts this to a standard connection string. When the driver opens socket connections it will have one for each replica set member. These connections will need to be allowed by the CloudCode egress proxy to work.
Before contacting JourneyApps support to get your egress token, retrieve your SRV string from Atlas and run the following commands to get the replicas domains:

# your SRV is mongodb+srv://<username>:<password>@cluster1.vlnzcbp.mongodb.net
# You can run it with the included credentials
npx @journeyapps/https-proxy-socket mongo-replicas mongodb+srv://your_username:[email protected]
# Or without
npx @journeyapps/https-proxy-socket mongo-replicas mongodb+srv://cluster1.vlnzcbp.mongodb.net

This will output the below to your console:

{
  replicas: 'ac-mayaavr-shard-00-02.vlnzcbp.mongodb.net:27017,ac-mayaavr-shard-00-01.vlnzcbp.mongodb.net:27017,ac-mayaavr-shard-00-00.vlnzcbp.mongodb.net:27017';
}

When requesting the token from JourneyApps support, please provide the replicas string as well.