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

@lambdatest/node-tunnel

v4.0.8

Published

Nodejs bindings for LambdaTest Tunnel

Downloads

371,385

Readme

LambdaTest Logo

LambdaTest Nodejs bindings for Tunnel

Node Tunnel health check

Installation

npm i @lambdatest/node-tunnel

Example

var lambdaTunnel = require('@lambdatest/node-tunnel');

//Creates an instance of Tunnel
var tunnelInstance = new lambdaTunnel();

// Replace <lambdatest-user> with your user and <lambdatest-accesskey> with your key.
var tunnelArguments = {
  user: process.env.LT_USERNAME || '<lambdatest-user>',
  key: process.env.LT_ACCESS_KEY || '<lambdatest-accesskey>'
};

// Callback Style
// Atarts the Tunnel instance with the required arguments
tunnelInstance.start(tunnelArguments, function(error, status) {
  if (!error) {
    console.log('Tunnel is Running Successfully');
  }
});

// Promise Style
tunnelInstance
  .start(tunnelArguments)
  .then(status => {
    console.log('Tunnel is Running Successfully');
  })
  .catch(error => {
    console.log(error);
  });

// Async/Await Style
(async function() {
  try {
    const istunnelStarted = await tunnelInstance.start(tunnelArguments);
    console.log('Tunnel is Running Successfully');
  } catch (error) {
    console.log(error);
  }
})();

Methods

tunnelInstance.start(tunnelArguments, callback)

Start tunnel Instance.

  • tunnelArguments: credentials for secure tunnel connection.
    • user: The username for the LambdaTest account.
    • key: The accessKey for the LambdaTest account.
  • callback (function(error, status)): A callback to invoke when the API call is complete.
// Callback Style
tunnelInstance.start(tunnelArguments, function(error, status) {
  if (!error) {
    console.log('Tunnel is Running Successfully');
  }
});

// Promise Style
tunnelInstance
  .start(tunnelArguments)
  .then(status => {
    console.log('Tunnel is Running Successfully');
  })
  .catch(error => {
    console.log(error);
  });

// Async/Await Style
(async function() {
  try {
    const istunnelStarted = await tunnelInstance.start(tunnelArguments);
    console.log('Tunnel is Running Successfully');
  } catch (error) {
    console.log(error);
  }
})();

tunnelInstance.isRunning()

Get Status of tunnel Instance.

// Callback Style
tunnelInstance.start(tunnelArguments, function(error, status) {
  if (!error) {
    console.log('Tunnel is Running Successfully');
    var tunnelRunningStatus = tunnelInstance.isRunning();
    console.log('Tunnel is Running ? ' + tunnelRunningStatus);
  }
});

// Promise Style
tunnelInstance
  .start(tunnelArguments)
  .then(status => {
    console.log('Tunnel is Running Successfully');
    const tunnelRunningStatus = tunnelInstance.isRunning();
    console.log('Tunnel is Running ? ' + tunnelRunningStatus);
  })
  .catch(error => {
    console.log(error);
  });

// Async/Await Style
(async function() {
  try {
    const istunnelStarted = await tunnelInstance.start(tunnelArguments);
    console.log('Tunnel is Running Successfully');
    const tunnelRunningStatus = tunnelInstance.isRunning();
    console.log('Tunnel is Running ? ' + tunnelRunningStatus);
  } catch (error) {
    console.log(error);
  }
})();

tunnelInstance.getTunnelName(callback)

Get name of the Running tunnel Instance.

  • callback (function(tunnelName)): A callback to invoke when the API call is complete.
// Callback Style
tunnelInstance.start(tunnelArguments, function(error, status) {
  if (!error) {
    console.log('Tunnel is Running Successfully');
    tunnelInstance.getTunnelName(function(tunnelName) {
      console.log('Tunnel Name : ' + tunnelName);
    });
  }
});

// Promise Style
tunnelInstance
  .start(tunnelArguments)
  .then(status => {
    console.log('Tunnel is Running Successfully');
    tunnelInstance.getTunnelName().then(tunnelName => {
      console.log('Tunnel Name : ' + tunnelName);
    });
  })
  .catch(error => {
    console.log(error);
  });

// Async/Await Style
(async function() {
  try {
    const istunnelStarted = await tunnelInstance.start(tunnelArguments);
    console.log('Tunnel is Running Successfully');
    const tunnelName = await tunnelInstance.getTunnelName();
    console.log('Tunnel Name : ' + tunnelName);
  } catch (error) {
    console.log(error);
  }
})();

tunnelInstance.stop(callback)

Stop the Running tunnel Instance.

  • callback (function(error, status)): A callback to invoke when the API call is complete.
// Callback Style
tunnelInstance.start(tunnelArguments, function(error, status) {
  if (!error) {
    console.log('Tunnel is Running Successfully');
    tunnelInstance.stop(function(error, status) {
      console.log('Tunnel is Stopped ? ' + status);
    });
  }
});

// Promise Style
tunnelInstance
  .start(tunnelArguments)
  .then(status => {
    console.log('Tunnel is Running Successfully');
    tunnelInstance.stop().then(status => {
      console.log('Tunnel is Stopped ? ' + status);
    });
  })
  .catch(error => {
    console.log(error);
  });

// Async/Await Style
(async function() {
  try {
    const istunnelStarted = await tunnelInstance.start(tunnelArguments);
    console.log('Tunnel is Running Successfully');
    const status = await tunnelInstance.stop();
    console.log('Tunnel is Stopped ? ' + status);
  } catch (error) {
    console.log(error);
  }
})();

Arguments

Every modifier except user and key is optional. Visit LambdaTest tunnel modifiers for an entire list of modifiers. Below are demonstration of some modifiers for your reference.

LambdaTest Basic Credentials

Below credentials will be used to perform basic authentication of your LambdaTest account.

  • user (Username of your LambdaTest account)
  • key (Access Key of your LambdaTest account)

Port

If you wish to connect tunnel on a specific port.

  • port : (optional) Local port to connect tunnel.
tunnelArguments = {
  user: process.env.LT_USERNAME || '<lambdatest-user>',
  key: process.env.LT_ACCESS_KEY || '<lambdatest-accesskey>',
  port: '<port>'
};

Proxy

If you wish to perform tunnel testing using a proxy.

  • proxyhost: Hostname/IP of proxy, this is a mandatory value.
  • proxyport: Port for the proxy, by default it would consider 3128 if proxyhost is used For Basic Authentication, we use the below proxy options:
  • proxyuser: Username for connecting to proxy, mandatory value for using 'proxypass'
  • proxypass: Password for the USERNAME option.
tunnelArguments = {
  user: process.env.LT_USERNAME || '<lambdatest-user>',
  key: process.env.LT_ACCESS_KEY || '<lambdatest-accesskey>',
  proxyHost: '127.0.0.1',
  proxyPort: '8000',
  proxyUser: 'user',
  proxyPass: 'password'
};

Tunnel Name

Human readable tunnel identifier

  • tunnelName: (Name of the tunnel)
tunnelArguments = {
  user: process.env.LT_USERNAME || '<lambdatest-user>',
  key: process.env.LT_ACCESS_KEY || '<lambdatest-accesskey>',
  tunnelName: '<your-tunnel-name>'
};

Testing Local Folder

Populate the path of the local folder you want to test in your internal server as a value in the below modifier.

  • dir/localdir/localdirectory : Path of the local folder you want to test
tunnelArguments = {
  user: process.env.LT_USERNAME || '<lambdatest-user>',
  key: process.env.LT_ACCESS_KEY || '<lambdatest-accesskey>',
  dir: '<path of the local folder you want to test>'
};

Enable Verbose Logging

To log every request to stdout.

  • v/verbose : true or false
tunnelArguments = {
  user: process.env.LT_USERNAME || '<lambdatest-user>',
  key: process.env.LT_ACCESS_KEY || '<lambdatest-accesskey>',
  v: true
};

Additional Arguments

Logfile You can provide a specific path to this file. If you won't provide a path then the logs would be saved in your present working directory by the filename: tunnel.log. For providing a specific path use the below argument:

  • logFile : path
tunnelArguments = {
  user: process.env.LT_USERNAME || '<lambdatest-user>',
  key: process.env.LT_ACCESS_KEY || '<lambdatest-accesskey>',
  logFile: '/lambdatest/logs.txt'
};
  • egressOnly: Uses proxy settings only for outbound requests.
  • ingressOnly: Uses proxy settings only for inbound requests.
  • dns: Comma separated list of dns servers
  • sshConnType: Specify type of ssh connection (over_22, over_443, over_ws)
  • mode: Specifies in which mode tunnel should run [ssh,ws]
  • nows: Force tunnel to run in non websocket mode
  • mitm: MITM mode, used for testing websites with private certificates

Contribute

Reporting bugs

Our GitHub Issue Tracker will help you log bug reports.

Tips for submitting an issue: Keep in mind, you don't end up submitting two issues with the same information. Make sure you add a unique input in every issue that you submit. You could also provide a "+1" value in the comments.

Always provide the steps to reproduce before you submit a bug. Provide the environment details where you received the issue i.e. Browser Name, Browser Version, Operating System, Screen Resolution and more. Describe the situation that led to your encounter with bug. Describe the expected output, and the actual output precisely.

Pull Requests

We don't want to pull breaks in case you want to customize your LambdaTest experience. Before you proceed with implementing pull requests, keep in mind the following. Make sure you stick to coding conventions. Once you include tests, ensure that they all pass. Make sure to clean up your Git history, prior your submission of a pull-request. You can do so by using the interactive rebase command for committing and squashing, simultaneously with minor changes + fixes into the corresponding commits.

About LambdaTest

LambdaTest is a cloud based selenium grid infrastructure that can help you run automated cross browser compatibility tests on 2000+ different browser and operating system environments. LambdaTest supports all programming languages and frameworks that are supported with Selenium, and have easy integrations with all popular CI/CD platforms. It's a perfect solution to bring your selenium automation testing to cloud based infrastructure that not only helps you increase your test coverage over multiple desktop and mobile browsers, but also allows you to cut down your test execution time by running tests on parallel.