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 🙏

© 2024 – Pkg Stats / Ryan Hefner

adit

v1.0.11

Published

SSH tunnels - in any way you want it

Downloads

380

Readme

Build Status Coverage Status

Adit

Forward all your stuff through ssh tunnel.

There is a lot of examples out there how this could be useful, for example, check out "SSH Tunnel - Local and Remote Port Forwarding Explained With Examples"

Usage

ssh and Adit

$ ssh -L 9000:imgur.com:80 example.com
new Adit('9000:imgur.com:80 example.com'/*, password*/).forward().then(adit => {
  console.log('success');

  adit.close();
});

$ ssh -R 9000:localhost:3000 example.com

new Adit('9000:localhost:3000 example.com'/*, password*/).reverse().then(adit => {
  console.log('success');

  adit.close();
});

Listen for events

let server = new Adit(...);
server.on('ready', ...);
server.on('tcp connection', ...)
server.on('error', ...);
server.on('data', ...);

server.forward(...).then(...);

Thorough

import Adit from 'adit';

let adit = new Adit({
  
  host: `example.com`

  // Everything else is optional
  // username: 'tester' // By default, `USER` environment variable will be used

  // port: 22, // 22 By default
  // Or port range - 
  // port: [22, 23], the first available port of the three will be used

  // Also, see "Authentification strategy" below - 
  // "agent": "path",
  // "password": "pass",
  // "key": Buffer
});

// Or just
let adit = new Adit('example.com');

// `3` - is how many times we want to try to connect, before bailing out */
adit.open(3).then(connection => {
  // At this point we established connection with remote server

  // Forward all connections from **local** server to remote one
  connection.out({
    // from
    host: 'example.com'
    port: 80
  }, {
    // To
    host: 'localhost'
    port: 8080,
    // Or port range - 
    // port: [25, 28], the first available port of the three will be used
  }).then(() => {
    // Forwarding is enabled
  });

  // Forward all connections from **remote** server to local one
  connection.in({
    // from
    host: 'example.com'
    port: 80,
    // Or port range - 
    // port: [25, 28], the first available port of the three will be used
  }, {
    // To
    host: 'localhost'
    port: 8080
  }).then(() => {
    // Forwarding is enabled
  });
}, error => {
  console.error(error);
});

adit.on('error', () => {
  // Report error
});

// Then, after awhile you would want to close it
adit.close();

Authentification strategy

  • If password is defined - use it
  • If agent or key is defined explicitly - use one of them, prioritize the agent
  • If agent or key is not passed - use environment varibles (SSH_AUTH_SOCK for agent)

Note: if key is used, assume it is added without passphrase, otherwise you should use agent