How to use screener-ngrok - 2 common examples

To help you get started, we’ve selected a few screener-ngrok examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github screener-io / screener-runner / src / tunnel.js View on Github external
if (/^https/.test(urlObj.protocol)) {
    options.addr = 'https://' + urlObj.hostname;
    if (urlObj.port) {
      options.addr += ':' + urlObj.port;
    }
    options.host_header = 'rewrite';
  } else { // http:
    var port = urlObj.port || 80;
    options.addr = urlObj.hostname + ':' + port;
    options.host_header = urlObj.hostname;
    if (port !== 80) {
      // include port in host header when not default port 80
      options.host_header += ':' + port;
    }
  }
  var connect = Promise.promisify(ngrok.connect);
  return connect(options)
    .then(tunnelUrl => {
      var urlObj = url.parse(tunnelUrl);
      console.log('Connected private encrypted tunnel to ' + host + ' (' + urlObj.host.split('.')[0] + ')');
      return urlObj.host;
    })
    .catch(ex => {
      if (tries < 2) {
        // on error, wait and retry
        return Promise.delay(1000).then(() =>
          exports.connect(host, token, tries + 1)
        );
      }
      throw ex;
    });
};
github screener-io / screener-runner / src / tunnel.js View on Github external
exports.disconnect = function() {
  ngrok.disconnect();
};

screener-ngrok

node wrapper for ngrok

BSD-2-Clause
Latest version published 3 years ago

Package Health Score

57 / 100
Full package analysis

Popular screener-ngrok functions