mirror of
https://github.com/bitinflow/localtunnel.git
synced 2026-03-14 14:05:54 +00:00
Compare commits
49 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7e450177b | ||
|
|
24475fef1b | ||
|
|
2a74d6be9f | ||
|
|
d7330a7121 | ||
|
|
57549598f3 | ||
|
|
e9d92039bb | ||
|
|
be3dc1a4cc | ||
|
|
4d6db16235 | ||
|
|
41270db62f | ||
|
|
42ea8ecfa5 | ||
|
|
5b313bdfaa | ||
|
|
ef78c1978e | ||
|
|
d0fc61ca97 | ||
|
|
a4bf6d16e4 | ||
|
|
9a38b8de0f | ||
|
|
c524872323 | ||
|
|
2372ec22cc | ||
|
|
db22a4efe0 | ||
|
|
610484b9d7 | ||
|
|
86deca52f2 | ||
|
|
cb3441a339 | ||
|
|
32fd1fdcbd | ||
|
|
14cac6f6c8 | ||
|
|
1f33d4992d | ||
|
|
578dc9aaae | ||
|
|
4c136a265c | ||
|
|
627cfe4783 | ||
|
|
dbe0c16024 | ||
|
|
c87bbe82e7 | ||
|
|
c71ba81972 | ||
|
|
8efcb3a294 | ||
|
|
b9c1901d60 | ||
|
|
edc182125f | ||
|
|
81c28d4d68 | ||
|
|
9a1d48764a | ||
|
|
371db2870a | ||
|
|
4ae493ae44 | ||
|
|
f487effe3a | ||
|
|
333af2b08f | ||
|
|
b32041d8aa | ||
|
|
649de1b840 | ||
|
|
f791217756 | ||
|
|
cce9d1490a | ||
|
|
86cd2d3c58 | ||
|
|
d70c743014 | ||
|
|
4940043378 | ||
|
|
b4a22bff64 | ||
|
|
176ec0479d | ||
|
|
fe316de3e0 |
21
.eslintrc.js
Normal file
21
.eslintrc.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
module.exports = {
|
||||||
|
parser: 'babel-eslint',
|
||||||
|
extends: ['airbnb', 'prettier', 'plugin:jest/recommended'],
|
||||||
|
plugins: ['prettier', 'jest'],
|
||||||
|
env: {
|
||||||
|
'jest/globals': true,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'prettier/prettier': [
|
||||||
|
'warn',
|
||||||
|
{
|
||||||
|
printWidth: 100,
|
||||||
|
tabWidth: 2,
|
||||||
|
bracketSpacing: true,
|
||||||
|
trailingComma: 'es5',
|
||||||
|
singleQuote: true,
|
||||||
|
jsxBracketSameLine: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1 +1 @@
|
|||||||
node_modules
|
/node_modules
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
support
|
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
|
dist: xenial
|
||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- "0.10"
|
- "8"
|
||||||
|
- "10"
|
||||||
|
- "12"
|
||||||
|
|||||||
73
CHANGELOG.md
Normal file
73
CHANGELOG.md
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
# 2.0.0 (2019-09-16)
|
||||||
|
|
||||||
|
- Add support for tunneling a local HTTPS server
|
||||||
|
- Add support for localtunnel server with IP-based tunnel URLs
|
||||||
|
- Node.js client API is now Promise-based, with backwards compatibility to callback
|
||||||
|
- Major refactor of entire codebase using modern ES syntax (requires Node.js v8.3.0 or above)
|
||||||
|
|
||||||
|
# 1.9.2 (2019-06-01)
|
||||||
|
|
||||||
|
- Update debug to 4.1.1
|
||||||
|
- Update axios to 0.19.0
|
||||||
|
|
||||||
|
# 1.9.1 (2018-09-08)
|
||||||
|
|
||||||
|
- Update debug to 2.6.9
|
||||||
|
|
||||||
|
# 1.9.0 (2018-04-03)
|
||||||
|
|
||||||
|
- Add _request_ event to Tunnel emitter
|
||||||
|
- Update yargs to support config via environment variables
|
||||||
|
- Add basic request logging when --print-requests argument is used
|
||||||
|
|
||||||
|
# 1.8.3 (2017-06-11)
|
||||||
|
|
||||||
|
- update request dependency
|
||||||
|
- update debug dependency
|
||||||
|
- update openurl dependency
|
||||||
|
|
||||||
|
# 1.8.2 (2016-11-17)
|
||||||
|
|
||||||
|
- fix host header transform
|
||||||
|
- update request dependency
|
||||||
|
|
||||||
|
# 1.8.1 (2016-01-20)
|
||||||
|
|
||||||
|
- fix bug w/ HostHeaderTransformer and binary data
|
||||||
|
|
||||||
|
# 1.8.0 (2015-11-04)
|
||||||
|
|
||||||
|
- pass socket errors up to top level
|
||||||
|
|
||||||
|
# 1.7.0 (2015-07-22)
|
||||||
|
|
||||||
|
- add short arg options
|
||||||
|
|
||||||
|
# 1.6.0 (2015-05-15)
|
||||||
|
|
||||||
|
- keep sockets alive after connecting
|
||||||
|
- add --open param to CLI
|
||||||
|
|
||||||
|
# 1.5.0 (2014-10-25)
|
||||||
|
|
||||||
|
- capture all errors on remote socket and restart the tunnel
|
||||||
|
|
||||||
|
# 1.4.0 (2014-08-31)
|
||||||
|
|
||||||
|
- don't emit errors for ETIMEDOUT
|
||||||
|
|
||||||
|
# 1.2.0 / 2014-04-28
|
||||||
|
|
||||||
|
- return `client` from `localtunnel` API instantiation
|
||||||
|
|
||||||
|
# 1.1.0 / 2014-02-24
|
||||||
|
|
||||||
|
- add a host header transform to change the 'Host' header in requests
|
||||||
|
|
||||||
|
# 1.0.0 / 2014-02-14
|
||||||
|
|
||||||
|
- default to localltunnel.me for host
|
||||||
|
- remove exported `connect` method (just export one function that does the same thing)
|
||||||
|
- change localtunnel signature to (port, opt, fn)
|
||||||
|
|
||||||
|
# 0.2.2 / 2014-01-09
|
||||||
32
History.md
32
History.md
@@ -1,32 +0,0 @@
|
|||||||
# 1.7.0 (2015-07-22)
|
|
||||||
|
|
||||||
* add short arg options
|
|
||||||
|
|
||||||
# 1.6.0 (2015-05-15)
|
|
||||||
|
|
||||||
* keep sockets alive after connecting
|
|
||||||
* add --open param to CLI
|
|
||||||
|
|
||||||
# 1.5.0 (2014-10-25)
|
|
||||||
|
|
||||||
* capture all errors on remote socket and restart the tunnel
|
|
||||||
|
|
||||||
# 1.4.0 (2014-08-31)
|
|
||||||
|
|
||||||
* don't emit errors for ETIMEDOUT
|
|
||||||
|
|
||||||
# 1.2.0 / 2014-04-28
|
|
||||||
|
|
||||||
* return `client` from `localtunnel` API instantiation
|
|
||||||
|
|
||||||
# 1.1.0 / 2014-02-24
|
|
||||||
|
|
||||||
* add a host header transform to change the 'Host' header in requests
|
|
||||||
|
|
||||||
# 1.0.0 / 2014-02-14
|
|
||||||
|
|
||||||
* default to localltunnel.me for host
|
|
||||||
* remove exported `connect` method (just export one function that does the same thing)
|
|
||||||
* change localtunnel signature to (port, opt, fn)
|
|
||||||
|
|
||||||
# 0.2.2 / 2014-01-09
|
|
||||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2018 Roman Shtylman
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
107
README.md
107
README.md
@@ -1,20 +1,32 @@
|
|||||||
# localtunnel [](https://travis-ci.org/defunctzombie/localtunnel) #
|
# localtunnel
|
||||||
|
|
||||||
localtunnel exposes your localhost to the world for easy testing and sharing! No need to mess with DNS or deploy just to have others test out your changes.
|
localtunnel exposes your localhost to the world for easy testing and sharing! No need to mess with DNS or deploy just to have others test out your changes.
|
||||||
|
|
||||||
Great for working with browser testing tools like browserling or external api callback services like twilio which require a public url for callbacks.
|
Great for working with browser testing tools like browserling or external api callback services like twilio which require a public url for callbacks.
|
||||||
|
|
||||||
## installation ##
|
## Quickstart
|
||||||
|
|
||||||
|
```
|
||||||
|
npx localtunnel --port 8000
|
||||||
|
```
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### Globally
|
||||||
|
|
||||||
```
|
```
|
||||||
npm install -g localtunnel
|
npm install -g localtunnel
|
||||||
```
|
```
|
||||||
|
|
||||||
This will install the localtunnel module globally and add the 'lt' client cli tool to your PATH.
|
### As a dependency in your project
|
||||||
|
|
||||||
## use ##
|
```
|
||||||
|
yarn add localtunnel
|
||||||
|
```
|
||||||
|
|
||||||
Assuming your local server is running on port 8000, just use the ```lt``` command to start the tunnel.
|
## CLI usage
|
||||||
|
|
||||||
|
When localtunnel is installed globally, just use the `lt` command to start the tunnel.
|
||||||
|
|
||||||
```
|
```
|
||||||
lt --port 8000
|
lt --port 8000
|
||||||
@@ -22,68 +34,87 @@ lt --port 8000
|
|||||||
|
|
||||||
Thats it! It will connect to the tunnel server, setup the tunnel, and tell you what url to use for your testing. This url will remain active for the duration of your session; so feel free to share it with others for happy fun time!
|
Thats it! It will connect to the tunnel server, setup the tunnel, and tell you what url to use for your testing. This url will remain active for the duration of your session; so feel free to share it with others for happy fun time!
|
||||||
|
|
||||||
You can restart your local server all you want, ```lt``` is smart enough to detect this and reconnect once it is back.
|
You can restart your local server all you want, `lt` is smart enough to detect this and reconnect once it is back.
|
||||||
|
|
||||||
### arguments
|
### Arguments
|
||||||
|
|
||||||
Below are some common arguments. See `lt --help` for additional arguments
|
Below are some common arguments. See `lt --help` for additional arguments
|
||||||
|
|
||||||
* `--subdomain` request a named subdomain on the localtunnel server (default is random characters)
|
- `--subdomain` request a named subdomain on the localtunnel server (default is random characters)
|
||||||
* `--local-host` proxy to a hostname other than localhost
|
- `--local-host` proxy to a hostname other than localhost
|
||||||
|
|
||||||
## API ##
|
You may also specify arguments via env variables. E.x.
|
||||||
|
|
||||||
|
```
|
||||||
|
PORT=3000 lt
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
The localtunnel client is also usable through an API (for test integration, automation, etc)
|
The localtunnel client is also usable through an API (for test integration, automation, etc)
|
||||||
|
|
||||||
### localtunnel(port [,opts], fn)
|
### localtunnel(port [,options][,callback])
|
||||||
|
|
||||||
Creates a new localtunnel to the specified local `port`. `fn` will be called once you have been assigned a public localtunnel url. `opts` can be used to request a specific `subdomain`.
|
Creates a new localtunnel to the specified local `port`. Will return a Promise that resolves once you have been assigned a public localtunnel url. `options` can be used to request a specific `subdomain`. A `callback` function can be passed, in which case it won't return a Promise. This exists for backwards compatibility with the old Node-style callback API. You may also pass a single options object with `port` as a property.
|
||||||
|
|
||||||
```javascript
|
```js
|
||||||
var localtunnel = require('localtunnel');
|
const localtunnel = require('localtunnel');
|
||||||
|
|
||||||
var tunnel = localtunnel(port, function(err, tunnel) {
|
(async () => {
|
||||||
if (err) ...
|
const tunnel = await localtunnel({ port: 3000 });
|
||||||
|
|
||||||
// the assigned public url for your tunnel
|
// the assigned public url for your tunnel
|
||||||
// i.e. https://abcdefgjhij.localtunnel.me
|
// i.e. https://abcdefgjhij.localtunnel.me
|
||||||
tunnel.url;
|
tunnel.url;
|
||||||
});
|
|
||||||
|
|
||||||
tunnel.on('close', function() {
|
tunnel.on('close', () => {
|
||||||
// tunnels are closed
|
// tunnels are closed
|
||||||
});
|
});
|
||||||
|
})();
|
||||||
```
|
```
|
||||||
|
|
||||||
### opts
|
#### options
|
||||||
|
|
||||||
* `subdomain` A *string* value requesting a specific subdomain on the proxy server. **Note** You may not actually receive this name depending on availablily.
|
- `port` (number) [required] The local port number to expose through localtunnel.
|
||||||
* `local_host` Proxy to this hostname instead of `localhost`. This will also cause the `Host` header to be re-written to this value in proxied requests.
|
- `subdomain` (string) Request a specific subdomain on the proxy server. **Note** You may not actually receive this name depending on availability.
|
||||||
|
- `host` (string) URL for the upstream proxy server. Defaults to `https://localtunnel.me`.
|
||||||
|
- `local_host` (string) Proxy to this hostname instead of `localhost`. This will also cause the `Host` header to be re-written to this value in proxied requests.
|
||||||
|
- `local_https` (boolean) Enable tunneling to local HTTPS server.
|
||||||
|
- `local_cert` (string) Path to certificate PEM file for local HTTPS server.
|
||||||
|
- `local_key` (string) Path to certificate key file for local HTTPS server.
|
||||||
|
- `local_ca` (string) Path to certificate authority file for self-signed certificates.
|
||||||
|
- `allow_invalid_cert` (boolean) Disable certificate checks for your local HTTPS server (ignore cert/key/ca options).
|
||||||
|
|
||||||
|
Refer to [tls.createSecureContext](https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options) for details on the certificate options.
|
||||||
|
|
||||||
### Tunnel
|
### Tunnel
|
||||||
|
|
||||||
The `tunnel` instance returned to your callback emits the following events
|
The `tunnel` instance returned to your callback emits the following events
|
||||||
|
|
||||||
|event|args|description|
|
| event | args | description |
|
||||||
|----|----|----|
|
| ------- | ---- | ------------------------------------------------------------------------------------ |
|
||||||
|error|err|fires when an error happens on the tunnel|
|
| request | info | fires when a request is processed by the tunnel, contains _method_ and _path_ fields |
|
||||||
|close||fires when the tunnel has closed|
|
| error | err | fires when an error happens on the tunnel |
|
||||||
|
| close | | fires when the tunnel has closed |
|
||||||
|
|
||||||
The `tunnel instance has the following methods
|
The `tunnel` instance has the following methods
|
||||||
|
|
||||||
|method|args|description|
|
| method | args | description |
|
||||||
|----|----|----|
|
| ------ | ---- | ---------------- |
|
||||||
|close||close the tunnel|
|
| close | | close the tunnel |
|
||||||
|
|
||||||
## other clients ##
|
## other clients
|
||||||
|
|
||||||
Clients in other languages
|
Clients in other languages
|
||||||
|
|
||||||
*go* [gotunnelme](https://github.com/NoahShen/gotunnelme)
|
_go_ [gotunnelme](https://github.com/NoahShen/gotunnelme)
|
||||||
|
|
||||||
## server ##
|
_go_ [go-localtunnel](https://github.com/localtunnel/go-localtunnel)
|
||||||
|
|
||||||
See defunctzombie/localtunnel-server for details on the server that powers localtunnel.
|
## server
|
||||||
|
|
||||||
|
See [localtunnel/server](//github.com/localtunnel/server) for details on the server that powers localtunnel.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
## License ##
|
|
||||||
MIT
|
MIT
|
||||||
|
|||||||
62
bin/client
62
bin/client
@@ -1,62 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
var lt_client = require('../client');
|
|
||||||
var open_url = require('openurl');
|
|
||||||
|
|
||||||
var argv = require('yargs')
|
|
||||||
.usage('Usage: $0 --port [num] <options>')
|
|
||||||
.option('h', {
|
|
||||||
alias: 'host',
|
|
||||||
describe: 'Upstream server providing forwarding',
|
|
||||||
default: 'http://localtunnel.me'
|
|
||||||
})
|
|
||||||
.option('s', {
|
|
||||||
alias: 'subdomain',
|
|
||||||
describe: 'Request this subdomain'
|
|
||||||
})
|
|
||||||
.option('l', {
|
|
||||||
alias: 'local-host',
|
|
||||||
describe: 'Tunnel traffic to this host instead of localhost, override Host header to this host'
|
|
||||||
})
|
|
||||||
.options('o', {
|
|
||||||
alias: 'open',
|
|
||||||
describe: 'opens url in your browser'
|
|
||||||
})
|
|
||||||
.option('p', {
|
|
||||||
alias: 'port',
|
|
||||||
describe: 'Internal http server port',
|
|
||||||
})
|
|
||||||
.require('port')
|
|
||||||
.help('help', 'Show this help and exit')
|
|
||||||
.version(require('../package').version)
|
|
||||||
.argv;
|
|
||||||
|
|
||||||
if (typeof argv.port !== 'number') {
|
|
||||||
require('yargs').showHelp();
|
|
||||||
console.error('port must be a number');
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
var opt = {
|
|
||||||
host: argv.host,
|
|
||||||
port: argv.port,
|
|
||||||
local_host: argv['local-host'],
|
|
||||||
subdomain: argv.subdomain,
|
|
||||||
};
|
|
||||||
|
|
||||||
lt_client(opt.port, opt, function(err, tunnel) {
|
|
||||||
if (err) {
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('your url is: %s', tunnel.url);
|
|
||||||
|
|
||||||
if (argv.open) {
|
|
||||||
open_url.open(tunnel.url);
|
|
||||||
}
|
|
||||||
|
|
||||||
tunnel.on('error', function(err) {
|
|
||||||
throw err;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// vim: ft=javascript
|
|
||||||
104
bin/lt.js
Executable file
104
bin/lt.js
Executable file
@@ -0,0 +1,104 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
/* eslint-disable no-console */
|
||||||
|
|
||||||
|
const openurl = require('openurl');
|
||||||
|
const yargs = require('yargs');
|
||||||
|
|
||||||
|
const localtunnel = require('../localtunnel');
|
||||||
|
const { version } = require('../package');
|
||||||
|
|
||||||
|
const { argv } = yargs
|
||||||
|
.usage('Usage: lt --port [num] <options>')
|
||||||
|
.env(true)
|
||||||
|
.option('p', {
|
||||||
|
alias: 'port',
|
||||||
|
describe: 'Internal HTTP server port',
|
||||||
|
})
|
||||||
|
.option('h', {
|
||||||
|
alias: 'host',
|
||||||
|
describe: 'Upstream server providing forwarding',
|
||||||
|
default: 'https://localtunnel.me',
|
||||||
|
})
|
||||||
|
.option('s', {
|
||||||
|
alias: 'subdomain',
|
||||||
|
describe: 'Request this subdomain',
|
||||||
|
})
|
||||||
|
.option('l', {
|
||||||
|
alias: 'local-host',
|
||||||
|
describe: 'Tunnel traffic to this host instead of localhost, override Host header to this host',
|
||||||
|
})
|
||||||
|
.option('local-https', {
|
||||||
|
describe: 'Tunnel traffic to a local HTTPS server',
|
||||||
|
})
|
||||||
|
.option('local-cert', {
|
||||||
|
describe: 'Path to certificate PEM file for local HTTPS server',
|
||||||
|
})
|
||||||
|
.option('local-key', {
|
||||||
|
describe: 'Path to certificate key file for local HTTPS server',
|
||||||
|
})
|
||||||
|
.option('local-ca', {
|
||||||
|
describe: 'Path to certificate authority file for self-signed certificates',
|
||||||
|
})
|
||||||
|
.option('allow-invalid-cert', {
|
||||||
|
describe: 'Disable certificate checks for your local HTTPS server (ignore cert/key/ca options)',
|
||||||
|
})
|
||||||
|
.options('o', {
|
||||||
|
alias: 'open',
|
||||||
|
describe: 'Opens the tunnel URL in your browser',
|
||||||
|
})
|
||||||
|
.option('print-requests', {
|
||||||
|
describe: 'Print basic request info',
|
||||||
|
})
|
||||||
|
.require('port')
|
||||||
|
.boolean('local-https')
|
||||||
|
.boolean('allow-invalid-cert')
|
||||||
|
.boolean('print-requests')
|
||||||
|
.help('help', 'Show this help and exit')
|
||||||
|
.version(version);
|
||||||
|
|
||||||
|
if (typeof argv.port !== 'number') {
|
||||||
|
yargs.showHelp();
|
||||||
|
console.error('\nInvalid argument: `port` must be a number');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
const tunnel = await localtunnel({
|
||||||
|
port: argv.port,
|
||||||
|
host: argv.host,
|
||||||
|
subdomain: argv.subdomain,
|
||||||
|
local_host: argv.localHost,
|
||||||
|
local_https: argv.localHttps,
|
||||||
|
local_cert: argv.localCert,
|
||||||
|
local_key: argv.localKey,
|
||||||
|
local_ca: argv.localCa,
|
||||||
|
allow_invalid_cert: argv.allowInvalidCert,
|
||||||
|
}).catch(err => {
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
|
|
||||||
|
tunnel.on('error', err => {
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('your url is: %s', tunnel.url);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* `cachedUrl` is set when using a proxy server that support resource caching.
|
||||||
|
* This URL generally remains available after the tunnel itself has closed.
|
||||||
|
* @see https://github.com/localtunnel/localtunnel/pull/319#discussion_r319846289
|
||||||
|
*/
|
||||||
|
if (tunnel.cachedUrl) {
|
||||||
|
console.log('your cachedUrl is: %s', tunnel.cachedUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argv.open) {
|
||||||
|
openurl.open(tunnel.url);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argv['print-requests']) {
|
||||||
|
tunnel.on('request', info => {
|
||||||
|
console.log(new Date().toString(), info.method, info.path);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})();
|
||||||
24
client.js
24
client.js
@@ -1,24 +0,0 @@
|
|||||||
var EventEmitter = require('events').EventEmitter;
|
|
||||||
var debug = require('debug')('localtunnel:client');
|
|
||||||
|
|
||||||
var Tunnel = require('./lib/Tunnel');
|
|
||||||
|
|
||||||
module.exports = function localtunnel(port, opt, fn) {
|
|
||||||
if (typeof opt === 'function') {
|
|
||||||
fn = opt;
|
|
||||||
opt = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
opt = opt || {};
|
|
||||||
opt.port = port;
|
|
||||||
|
|
||||||
var client = Tunnel(opt);
|
|
||||||
client.open(function(err) {
|
|
||||||
if (err) {
|
|
||||||
return fn(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn(null, client);
|
|
||||||
});
|
|
||||||
return client;
|
|
||||||
};
|
|
||||||
@@ -1,39 +1,23 @@
|
|||||||
var stream = require('stream');
|
const { Transform } = require('stream');
|
||||||
var util = require('util');
|
|
||||||
|
|
||||||
var Transform = stream.Transform;
|
class HeaderHostTransformer extends Transform {
|
||||||
|
constructor(opts = {}) {
|
||||||
|
super(opts);
|
||||||
|
this.host = opts.host || 'localhost';
|
||||||
|
this.replaced = false;
|
||||||
|
}
|
||||||
|
|
||||||
var HeaderHostTransformer = function(opts) {
|
_transform(data, encoding, callback) {
|
||||||
if (!(this instanceof HeaderHostTransformer)) {
|
callback(
|
||||||
return new HeaderHostTransformer(opts);
|
null,
|
||||||
}
|
this.replaced // after replacing the first instance of the Host header we just become a regular passthrough
|
||||||
|
? data
|
||||||
opts = opts || {}
|
: data.toString().replace(/(\r\n[Hh]ost: )\S+/, (match, $1) => {
|
||||||
Transform.call(this, opts);
|
this.replaced = true;
|
||||||
|
return $1 + this.host;
|
||||||
var self = this;
|
})
|
||||||
self.host = opts.host || 'localhost';
|
);
|
||||||
self.replaced = false;
|
}
|
||||||
}
|
}
|
||||||
util.inherits(HeaderHostTransformer, Transform);
|
|
||||||
|
|
||||||
HeaderHostTransformer.prototype._transform = function (chunk, enc, cb) {
|
|
||||||
var self = this;
|
|
||||||
chunk = chunk.toString();
|
|
||||||
|
|
||||||
// after replacing the first instance of the Host header
|
|
||||||
// we just become a regular passthrough
|
|
||||||
if (!self.replaced) {
|
|
||||||
self.push(chunk.replace(/(\r\nHost: )\S+/, function(match, $1) {
|
|
||||||
self.replaced = true;
|
|
||||||
return $1 + self.host;
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
self.push(chunk);
|
|
||||||
}
|
|
||||||
|
|
||||||
cb();
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = HeaderHostTransformer;
|
module.exports = HeaderHostTransformer;
|
||||||
|
|||||||
237
lib/Tunnel.js
237
lib/Tunnel.js
@@ -1,152 +1,163 @@
|
|||||||
var url = require('url');
|
/* eslint-disable consistent-return, no-underscore-dangle */
|
||||||
var EventEmitter = require('events').EventEmitter;
|
|
||||||
var request = require('request');
|
|
||||||
var debug = require('debug')('localtunnel:client');
|
|
||||||
|
|
||||||
var TunnelCluster = require('./TunnelCluster');
|
const { parse } = require('url');
|
||||||
|
const { EventEmitter } = require('events');
|
||||||
|
const axios = require('axios');
|
||||||
|
const debug = require('debug')('localtunnel:client');
|
||||||
|
|
||||||
var Tunnel = function(opt) {
|
const TunnelCluster = require('./TunnelCluster');
|
||||||
if (!(this instanceof Tunnel)) {
|
|
||||||
return new Tunnel(opt);
|
module.exports = class Tunnel extends EventEmitter {
|
||||||
|
constructor(opts = {}) {
|
||||||
|
super(opts);
|
||||||
|
this.opts = opts;
|
||||||
|
this.closed = false;
|
||||||
|
if (!this.opts.host) {
|
||||||
|
this.opts.host = 'https://localtunnel.me';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var self = this;
|
_getInfo(body) {
|
||||||
self._closed = false;
|
/* eslint-disable camelcase */
|
||||||
self._opt = opt || {};
|
const { id, ip, port, url, cached_url, max_conn_count } = body;
|
||||||
|
const { host, port: local_port, local_host } = this.opts;
|
||||||
|
const { local_https, local_cert, local_key, local_ca, allow_invalid_cert } = this.opts;
|
||||||
|
return {
|
||||||
|
name: id,
|
||||||
|
url,
|
||||||
|
cached_url,
|
||||||
|
max_conn: max_conn_count || 1,
|
||||||
|
remote_host: parse(host).hostname,
|
||||||
|
remote_ip: ip,
|
||||||
|
remote_port: port,
|
||||||
|
local_port,
|
||||||
|
local_host,
|
||||||
|
local_https,
|
||||||
|
local_cert,
|
||||||
|
local_key,
|
||||||
|
local_ca,
|
||||||
|
allow_invalid_cert,
|
||||||
|
};
|
||||||
|
/* eslint-enable camelcase */
|
||||||
|
}
|
||||||
|
|
||||||
self._opt.host = self._opt.host || 'https://localtunnel.me';
|
// initialize connection
|
||||||
};
|
// callback with connection info
|
||||||
|
_init(cb) {
|
||||||
|
const opt = this.opts;
|
||||||
|
const getInfo = this._getInfo.bind(this);
|
||||||
|
|
||||||
Tunnel.prototype.__proto__ = EventEmitter.prototype;
|
const params = {
|
||||||
|
responseType: 'json',
|
||||||
// initialize connection
|
|
||||||
// callback with connection info
|
|
||||||
Tunnel.prototype._init = function(cb) {
|
|
||||||
var self = this;
|
|
||||||
var opt = self._opt;
|
|
||||||
|
|
||||||
var params = {
|
|
||||||
path: '/',
|
|
||||||
json: true
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var base_uri = opt.host + '/';
|
const baseUri = `${opt.host}/`;
|
||||||
|
|
||||||
// optionally override the upstream server
|
|
||||||
var upstream = url.parse(opt.host);
|
|
||||||
|
|
||||||
// no subdomain at first, maybe use requested domain
|
// no subdomain at first, maybe use requested domain
|
||||||
var assigned_domain = opt.subdomain;
|
const assignedDomain = opt.subdomain;
|
||||||
|
|
||||||
// where to quest
|
// where to quest
|
||||||
params.uri = base_uri + ((assigned_domain) ? assigned_domain : '?new');
|
const uri = baseUri + (assignedDomain || '?new');
|
||||||
|
|
||||||
(function get_url() {
|
(function getUrl() {
|
||||||
request(params, function(err, res, body) {
|
axios
|
||||||
if (err) {
|
.get(uri, params)
|
||||||
// TODO (shtylman) don't print to stdout?
|
.then(res => {
|
||||||
console.log('tunnel server offline: ' + err.message + ', retry 1s');
|
const body = res.data;
|
||||||
return setTimeout(get_url, 1000);
|
debug('got tunnel information', res.data);
|
||||||
}
|
if (res.status !== 200) {
|
||||||
|
const err = new Error(
|
||||||
if (res.statusCode !== 200) {
|
(body && body.message) || 'localtunnel server returned an error, please try again'
|
||||||
var err = new Error((body && body.message) || 'localtunnel server returned an error, please try again');
|
);
|
||||||
return cb(err);
|
return cb(err);
|
||||||
}
|
}
|
||||||
|
cb(null, getInfo(body));
|
||||||
var port = body.port;
|
})
|
||||||
var host = upstream.hostname;
|
.catch(err => {
|
||||||
|
debug(`tunnel server offline: ${err.message}, retry 1s`);
|
||||||
var max_conn = body.max_conn_count || 1;
|
return setTimeout(getUrl, 1000);
|
||||||
|
|
||||||
cb(null, {
|
|
||||||
remote_host: upstream.hostname,
|
|
||||||
remote_port: body.port,
|
|
||||||
name: body.id,
|
|
||||||
url: body.url,
|
|
||||||
max_conn: max_conn
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
};
|
}
|
||||||
|
|
||||||
Tunnel.prototype._establish = function(info) {
|
|
||||||
var self = this;
|
|
||||||
var opt = self._opt;
|
|
||||||
|
|
||||||
|
_establish(info) {
|
||||||
// increase max event listeners so that localtunnel consumers don't get
|
// increase max event listeners so that localtunnel consumers don't get
|
||||||
// warning messages as soon as they setup even one listener. See #71
|
// warning messages as soon as they setup even one listener. See #71
|
||||||
self.setMaxListeners(info.max_conn + (EventEmitter.defaultMaxListeners || 10));
|
this.setMaxListeners(info.max_conn + (EventEmitter.defaultMaxListeners || 10));
|
||||||
|
|
||||||
info.local_host = opt.local_host;
|
this.tunnelCluster = new TunnelCluster(info);
|
||||||
info.local_port = opt.port;
|
|
||||||
|
|
||||||
var tunnels = self.tunnel_cluster = TunnelCluster(info);
|
|
||||||
|
|
||||||
// only emit the url the first time
|
// only emit the url the first time
|
||||||
tunnels.once('open', function() {
|
this.tunnelCluster.once('open', () => {
|
||||||
self.emit('url', info.url);
|
this.emit('url', info.url);
|
||||||
});
|
});
|
||||||
|
|
||||||
var tunnel_count = 0;
|
// re-emit socket error
|
||||||
|
this.tunnelCluster.on('error', err => {
|
||||||
|
debug('got socket error', err.message);
|
||||||
|
this.emit('error', err);
|
||||||
|
});
|
||||||
|
|
||||||
|
let tunnelCount = 0;
|
||||||
|
|
||||||
// track open count
|
// track open count
|
||||||
tunnels.on('open', function(tunnel) {
|
this.tunnelCluster.on('open', tunnel => {
|
||||||
tunnel_count++;
|
tunnelCount++;
|
||||||
debug('tunnel open [total: %d]', tunnel_count);
|
debug('tunnel open [total: %d]', tunnelCount);
|
||||||
|
|
||||||
var close_handler = function() {
|
const closeHandler = () => {
|
||||||
tunnel.destroy();
|
tunnel.destroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
if (self._closed) {
|
if (this.closed) {
|
||||||
return close_handler();
|
return closeHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
self.once('close', close_handler);
|
this.once('close', closeHandler);
|
||||||
tunnel.once('close', function() {
|
tunnel.once('close', () => {
|
||||||
self.removeListener('close', close_handler);
|
this.removeListener('close', closeHandler);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// when a tunnel dies, open a new one
|
// when a tunnel dies, open a new one
|
||||||
tunnels.on('dead', function(tunnel) {
|
this.tunnelCluster.on('dead', () => {
|
||||||
tunnel_count--;
|
tunnelCount--;
|
||||||
debug('tunnel dead [total: %d]', tunnel_count);
|
debug('tunnel dead [total: %d]', tunnelCount);
|
||||||
|
if (this.closed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.tunnelCluster.open();
|
||||||
|
});
|
||||||
|
|
||||||
if (self._closed) {
|
this.tunnelCluster.on('request', req => {
|
||||||
return;
|
this.emit('request', req);
|
||||||
}
|
|
||||||
|
|
||||||
tunnels.open();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// establish as many tunnels as allowed
|
// establish as many tunnels as allowed
|
||||||
for (var count = 0 ; count < info.max_conn ; ++count) {
|
for (let count = 0; count < info.max_conn; ++count) {
|
||||||
tunnels.open();
|
this.tunnelCluster.open();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
Tunnel.prototype.open = function(cb) {
|
open(cb) {
|
||||||
var self = this;
|
this._init((err, info) => {
|
||||||
|
if (err) {
|
||||||
|
return cb(err);
|
||||||
|
}
|
||||||
|
|
||||||
self._init(function(err, info) {
|
this.clientId = info.name;
|
||||||
if (err) {
|
this.url = info.url;
|
||||||
return cb(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
self.url = info.url;
|
// `cached_url` is only returned by proxy servers that support resource caching.
|
||||||
self._establish(info);
|
if (info.cached_url) {
|
||||||
cb();
|
this.cachedUrl = info.cached_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._establish(info);
|
||||||
|
cb();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
close() {
|
||||||
|
this.closed = true;
|
||||||
|
this.emit('close');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// shutdown tunnels
|
|
||||||
Tunnel.prototype.close = function() {
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
self._closed = true;
|
|
||||||
self.emit('close');
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = Tunnel;
|
|
||||||
|
|||||||
@@ -1,123 +1,152 @@
|
|||||||
var EventEmitter = require('events').EventEmitter;
|
const { EventEmitter } = require('events');
|
||||||
var debug = require('debug')('localtunnel:client');
|
const debug = require('debug')('localtunnel:client');
|
||||||
var net = require('net');
|
const fs = require('fs');
|
||||||
|
const net = require('net');
|
||||||
|
const tls = require('tls');
|
||||||
|
|
||||||
var HeaderHostTransformer = require('./HeaderHostTransformer');
|
const HeaderHostTransformer = require('./HeaderHostTransformer');
|
||||||
|
|
||||||
// manages groups of tunnels
|
// manages groups of tunnels
|
||||||
var TunnelCluster = function(opt) {
|
module.exports = class TunnelCluster extends EventEmitter {
|
||||||
if (!(this instanceof TunnelCluster)) {
|
constructor(opts = {}) {
|
||||||
return new TunnelCluster(opt);
|
super(opts);
|
||||||
}
|
this.opts = opts;
|
||||||
|
}
|
||||||
|
|
||||||
var self = this;
|
open() {
|
||||||
self._opt = opt;
|
const opt = this.opts;
|
||||||
|
|
||||||
EventEmitter.call(self);
|
// Prefer IP if returned by the server
|
||||||
};
|
const remoteHostOrIp = opt.remote_ip || opt.remote_host;
|
||||||
|
const remotePort = opt.remote_port;
|
||||||
|
const localHost = opt.local_host || 'localhost';
|
||||||
|
const localPort = opt.local_port;
|
||||||
|
const localProtocol = opt.local_https ? 'https' : 'http';
|
||||||
|
const allowInvalidCert = opt.allow_invalid_cert;
|
||||||
|
|
||||||
TunnelCluster.prototype.__proto__ = EventEmitter.prototype;
|
debug(
|
||||||
|
'establishing tunnel %s://%s:%s <> %s:%s',
|
||||||
// establish a new tunnel
|
localProtocol,
|
||||||
TunnelCluster.prototype.open = function() {
|
localHost,
|
||||||
var self = this;
|
localPort,
|
||||||
|
remoteHostOrIp,
|
||||||
var opt = self._opt || {};
|
remotePort
|
||||||
|
);
|
||||||
var remote_host = opt.remote_host;
|
|
||||||
var remote_port = opt.remote_port;
|
|
||||||
|
|
||||||
var local_host = opt.local_host || 'localhost';
|
|
||||||
var local_port = opt.local_port;
|
|
||||||
|
|
||||||
debug('establishing tunnel %s:%s <> %s:%s', local_host, local_port, remote_host, remote_port);
|
|
||||||
|
|
||||||
// connection to localtunnel server
|
// connection to localtunnel server
|
||||||
var remote = net.connect({
|
const remote = net.connect({
|
||||||
host: remote_host,
|
host: remoteHostOrIp,
|
||||||
port: remote_port
|
port: remotePort,
|
||||||
});
|
});
|
||||||
|
|
||||||
remote.setKeepAlive(true);
|
remote.setKeepAlive(true);
|
||||||
|
|
||||||
remote.on('error', function(err) {
|
remote.on('error', err => {
|
||||||
// emit connection refused errors immediately, because they
|
debug('got remote connection error', err.message);
|
||||||
// indicate that the tunnel can't be established.
|
|
||||||
if (err.code === 'ECONNREFUSED') {
|
|
||||||
self.emit('error', new Error('connection refused: ' + remote_host + ':' + remote_port + ' (check your firewall settings)'));
|
|
||||||
}
|
|
||||||
|
|
||||||
remote.end();
|
// emit connection refused errors immediately, because they
|
||||||
|
// indicate that the tunnel can't be established.
|
||||||
|
if (err.code === 'ECONNREFUSED') {
|
||||||
|
this.emit(
|
||||||
|
'error',
|
||||||
|
new Error(
|
||||||
|
`connection refused: ${remoteHostOrIp}:${remotePort} (check your firewall settings)`
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
remote.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
function conn_local() {
|
const connLocal = () => {
|
||||||
if (remote.destroyed) {
|
if (remote.destroyed) {
|
||||||
debug('remote destroyed');
|
debug('remote destroyed');
|
||||||
self.emit('dead');
|
this.emit('dead');
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('connecting locally to %s://%s:%d', localProtocol, localHost, localPort);
|
||||||
|
remote.pause();
|
||||||
|
|
||||||
|
if (allowInvalidCert) {
|
||||||
|
debug('allowing invalid certificates');
|
||||||
|
}
|
||||||
|
|
||||||
|
const getLocalCertOpts = () =>
|
||||||
|
allowInvalidCert
|
||||||
|
? { rejectUnauthorized: false }
|
||||||
|
: {
|
||||||
|
cert: fs.readFileSync(opt.local_cert),
|
||||||
|
key: fs.readFileSync(opt.local_key),
|
||||||
|
ca: opt.local_ca ? [fs.readFileSync(opt.local_ca)] : undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
// connection to local http server
|
||||||
|
const local = opt.local_https
|
||||||
|
? tls.connect({ host: localHost, port: localPort, ...getLocalCertOpts() })
|
||||||
|
: net.connect({ host: localHost, port: localPort });
|
||||||
|
|
||||||
|
const remoteClose = () => {
|
||||||
|
debug('remote close');
|
||||||
|
this.emit('dead');
|
||||||
|
local.end();
|
||||||
|
};
|
||||||
|
|
||||||
|
remote.once('close', remoteClose);
|
||||||
|
|
||||||
|
// TODO some languages have single threaded servers which makes opening up
|
||||||
|
// multiple local connections impossible. We need a smarter way to scale
|
||||||
|
// and adjust for such instances to avoid beating on the door of the server
|
||||||
|
local.once('error', err => {
|
||||||
|
debug('local error %s', err.message);
|
||||||
|
local.end();
|
||||||
|
|
||||||
|
remote.removeListener('close', remoteClose);
|
||||||
|
|
||||||
|
if (err.code !== 'ECONNREFUSED') {
|
||||||
|
return remote.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
debug('connecting locally to %s:%d', local_host, local_port);
|
// retrying connection to local server
|
||||||
remote.pause();
|
setTimeout(connLocal, 1000);
|
||||||
|
});
|
||||||
|
|
||||||
// connection to local http server
|
local.once('connect', () => {
|
||||||
var local = net.connect({
|
debug('connected locally');
|
||||||
host: local_host,
|
remote.resume();
|
||||||
port: local_port
|
|
||||||
|
let stream = remote;
|
||||||
|
|
||||||
|
// if user requested specific local host
|
||||||
|
// then we use host header transform to replace the host header
|
||||||
|
if (opt.local_host) {
|
||||||
|
debug('transform Host header to %s', opt.local_host);
|
||||||
|
stream = remote.pipe(new HeaderHostTransformer({ host: opt.local_host }));
|
||||||
|
}
|
||||||
|
|
||||||
|
stream.pipe(local).pipe(remote);
|
||||||
|
|
||||||
|
// when local closes, also get a new remote
|
||||||
|
local.once('close', hadError => {
|
||||||
|
debug('local connection closed [%s]', hadError);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
function remote_close() {
|
remote.on('data', data => {
|
||||||
debug('remote close');
|
const match = data.toString().match(/^(\w+) (\S+)/);
|
||||||
self.emit('dead');
|
if (match) {
|
||||||
local.end();
|
this.emit('request', {
|
||||||
};
|
method: match[1],
|
||||||
|
path: match[2],
|
||||||
remote.once('close', remote_close);
|
|
||||||
|
|
||||||
// TODO some languages have single threaded servers which makes opening up
|
|
||||||
// multiple local connections impossible. We need a smarter way to scale
|
|
||||||
// and adjust for such instances to avoid beating on the door of the server
|
|
||||||
local.once('error', function(err) {
|
|
||||||
debug('local error %s', err.message);
|
|
||||||
local.end();
|
|
||||||
|
|
||||||
remote.removeListener('close', remote_close);
|
|
||||||
|
|
||||||
if (err.code !== 'ECONNREFUSED') {
|
|
||||||
return remote.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
// retrying connection to local server
|
|
||||||
setTimeout(conn_local, 1000);
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
local.once('connect', function() {
|
});
|
||||||
debug('connected locally');
|
|
||||||
remote.resume();
|
|
||||||
|
|
||||||
var stream = remote;
|
|
||||||
|
|
||||||
// if user requested specific local host
|
|
||||||
// then we use host header transform to replace the host header
|
|
||||||
if (opt.local_host) {
|
|
||||||
debug('transform Host header to %s', opt.local_host);
|
|
||||||
stream = remote.pipe(HeaderHostTransformer({ host: opt.local_host }));
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.pipe(local).pipe(remote);
|
|
||||||
|
|
||||||
// when local closes, also get a new remote
|
|
||||||
local.once('close', function(had_error) {
|
|
||||||
debug('local connection closed [%s]', had_error);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// tunnel is considered open when remote connects
|
// tunnel is considered open when remote connects
|
||||||
remote.once('connect', function() {
|
remote.once('connect', () => {
|
||||||
self.emit('open', remote);
|
this.emit('open', remote);
|
||||||
conn_local();
|
connLocal();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = TunnelCluster;
|
|
||||||
|
|||||||
14
localtunnel.js
Normal file
14
localtunnel.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
const Tunnel = require('./lib/Tunnel');
|
||||||
|
|
||||||
|
module.exports = function localtunnel(arg1, arg2, arg3) {
|
||||||
|
const options = typeof arg1 === 'object' ? arg1 : { ...arg2, port: arg1 };
|
||||||
|
const callback = typeof arg1 === 'object' ? arg2 : arg3;
|
||||||
|
const client = new Tunnel(options);
|
||||||
|
if (callback) {
|
||||||
|
client.open(err => (err ? callback(err) : callback(null, client)));
|
||||||
|
return client;
|
||||||
|
}
|
||||||
|
return new Promise((resolve, reject) =>
|
||||||
|
client.open(err => (err ? reject(err) : resolve(client)))
|
||||||
|
);
|
||||||
|
};
|
||||||
162
localtunnel.spec.js
Normal file
162
localtunnel.spec.js
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
/* eslint-disable no-console */
|
||||||
|
|
||||||
|
const crypto = require('crypto');
|
||||||
|
const http = require('http');
|
||||||
|
const https = require('https');
|
||||||
|
const url = require('url');
|
||||||
|
const assert = require('assert');
|
||||||
|
|
||||||
|
const localtunnel = require('./localtunnel');
|
||||||
|
|
||||||
|
let fakePort;
|
||||||
|
|
||||||
|
before(done => {
|
||||||
|
const server = http.createServer();
|
||||||
|
server.on('request', (req, res) => {
|
||||||
|
res.write(req.headers.host);
|
||||||
|
res.end();
|
||||||
|
});
|
||||||
|
server.listen(() => {
|
||||||
|
const { port } = server.address();
|
||||||
|
fakePort = port;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('query localtunnel server w/ ident', async done => {
|
||||||
|
const tunnel = await localtunnel({ port: fakePort });
|
||||||
|
assert.ok(new RegExp('^https://.*localtunnel.me$').test(tunnel.url));
|
||||||
|
|
||||||
|
const parsed = url.parse(tunnel.url);
|
||||||
|
const opt = {
|
||||||
|
host: parsed.host,
|
||||||
|
port: 443,
|
||||||
|
headers: { host: parsed.hostname },
|
||||||
|
path: '/',
|
||||||
|
};
|
||||||
|
|
||||||
|
const req = https.request(opt, res => {
|
||||||
|
res.setEncoding('utf8');
|
||||||
|
let body = '';
|
||||||
|
|
||||||
|
res.on('data', chunk => {
|
||||||
|
body += chunk;
|
||||||
|
});
|
||||||
|
|
||||||
|
res.on('end', () => {
|
||||||
|
assert(/.*[.]localtunnel[.]me/.test(body), body);
|
||||||
|
tunnel.close();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
req.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('request specific domain', async () => {
|
||||||
|
const subdomain = Math.random()
|
||||||
|
.toString(36)
|
||||||
|
.substr(2);
|
||||||
|
const tunnel = await localtunnel({ port: fakePort, subdomain });
|
||||||
|
assert.ok(new RegExp(`^https://${subdomain}.localtunnel.me$`).test(tunnel.url));
|
||||||
|
tunnel.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('--local-host localhost', () => {
|
||||||
|
test('override Host header with local-host', async done => {
|
||||||
|
const tunnel = await localtunnel({ port: fakePort, local_host: 'localhost' });
|
||||||
|
assert.ok(new RegExp('^https://.*localtunnel.me$').test(tunnel.url));
|
||||||
|
|
||||||
|
const parsed = url.parse(tunnel.url);
|
||||||
|
const opt = {
|
||||||
|
host: parsed.host,
|
||||||
|
port: 443,
|
||||||
|
headers: { host: parsed.hostname },
|
||||||
|
path: '/',
|
||||||
|
};
|
||||||
|
|
||||||
|
const req = https.request(opt, res => {
|
||||||
|
res.setEncoding('utf8');
|
||||||
|
let body = '';
|
||||||
|
|
||||||
|
res.on('data', chunk => {
|
||||||
|
body += chunk;
|
||||||
|
});
|
||||||
|
|
||||||
|
res.on('end', () => {
|
||||||
|
assert.equal(body, 'localhost');
|
||||||
|
tunnel.close();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
req.end();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('--local-host 127.0.0.1', () => {
|
||||||
|
test('override Host header with local-host', async done => {
|
||||||
|
const tunnel = await localtunnel({ port: fakePort, local_host: '127.0.0.1' });
|
||||||
|
assert.ok(new RegExp('^https://.*localtunnel.me$').test(tunnel.url));
|
||||||
|
|
||||||
|
const parsed = url.parse(tunnel.url);
|
||||||
|
const opt = {
|
||||||
|
host: parsed.host,
|
||||||
|
port: 443,
|
||||||
|
headers: {
|
||||||
|
host: parsed.hostname,
|
||||||
|
},
|
||||||
|
path: '/',
|
||||||
|
};
|
||||||
|
|
||||||
|
const req = https.request(opt, res => {
|
||||||
|
res.setEncoding('utf8');
|
||||||
|
let body = '';
|
||||||
|
|
||||||
|
res.on('data', chunk => {
|
||||||
|
body += chunk;
|
||||||
|
});
|
||||||
|
|
||||||
|
res.on('end', () => {
|
||||||
|
assert.equal(body, '127.0.0.1');
|
||||||
|
tunnel.close();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
req.end();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('send chunked request', async done => {
|
||||||
|
const tunnel = await localtunnel({ port: fakePort, local_host: '127.0.0.1' });
|
||||||
|
assert.ok(new RegExp('^https://.*localtunnel.me$').test(tunnel.url));
|
||||||
|
|
||||||
|
const parsed = url.parse(tunnel.url);
|
||||||
|
const opt = {
|
||||||
|
host: parsed.host,
|
||||||
|
port: 443,
|
||||||
|
headers: {
|
||||||
|
host: parsed.hostname,
|
||||||
|
'Transfer-Encoding': 'chunked',
|
||||||
|
},
|
||||||
|
path: '/',
|
||||||
|
};
|
||||||
|
|
||||||
|
const req = https.request(opt, res => {
|
||||||
|
res.setEncoding('utf8');
|
||||||
|
let body = '';
|
||||||
|
|
||||||
|
res.on('data', chunk => {
|
||||||
|
body += chunk;
|
||||||
|
});
|
||||||
|
|
||||||
|
res.on('end', () => {
|
||||||
|
assert.equal(body, '127.0.0.1');
|
||||||
|
tunnel.close();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
req.end(crypto.randomBytes(1024 * 8).toString('base64'));
|
||||||
|
});
|
||||||
|
});
|
||||||
38
package.json
38
package.json
@@ -1,27 +1,35 @@
|
|||||||
{
|
{
|
||||||
"author": "Roman Shtylman <shtylman@gmail.com>",
|
|
||||||
"name": "localtunnel",
|
"name": "localtunnel",
|
||||||
"description": "expose localhost to the world",
|
"description": "Expose localhost to the world",
|
||||||
"version": "1.7.0",
|
"version": "2.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git://github.com/shtylman/localtunnel.git"
|
"url": "git://github.com/localtunnel/localtunnel.git"
|
||||||
|
},
|
||||||
|
"author": "Roman Shtylman <shtylman@gmail.com>",
|
||||||
|
"contributors": [
|
||||||
|
"Roman Shtylman <shtylman@gmail.com>",
|
||||||
|
"Gert Hengeveld <gert@hichroma.com>",
|
||||||
|
"Tom Coleman <tom@hichroma.com>"
|
||||||
|
],
|
||||||
|
"main": "./localtunnel.js",
|
||||||
|
"bin": {
|
||||||
|
"lt": "./bin/lt.js"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "mocha --ui qunit --reporter list --timeout 60000 -- *.spec.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"request": "2.11.4",
|
"axios": "0.19.0",
|
||||||
"yargs": "3.15.0",
|
"debug": "4.1.1",
|
||||||
"debug": "0.7.4",
|
"openurl": "1.1.1",
|
||||||
"openurl": "1.1.0"
|
"yargs": "13.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"mocha": "~1.17.0"
|
"mocha": "~1.17.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"engines": {
|
||||||
"test": "mocha --ui qunit --reporter list --timeout 10000 -- test/index.js"
|
"node": ">=8.3.0"
|
||||||
},
|
}
|
||||||
"bin": {
|
|
||||||
"lt": "./bin/client"
|
|
||||||
},
|
|
||||||
"main": "./client.js"
|
|
||||||
}
|
}
|
||||||
188
test/index.js
188
test/index.js
@@ -1,188 +0,0 @@
|
|||||||
var http = require('http');
|
|
||||||
var https = require('https');
|
|
||||||
var url = require('url');
|
|
||||||
var assert = require('assert');
|
|
||||||
|
|
||||||
var localtunnel = require('../');
|
|
||||||
|
|
||||||
test('setup local http server', function(done) {
|
|
||||||
var server = http.createServer();
|
|
||||||
server.on('request', function(req, res) {
|
|
||||||
res.write(req.headers.host);
|
|
||||||
res.end();
|
|
||||||
});
|
|
||||||
server.listen(function() {
|
|
||||||
var port = server.address().port;
|
|
||||||
|
|
||||||
test._fake_port = port;
|
|
||||||
console.log('local http on:', port);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test('setup localtunnel client', function(done) {
|
|
||||||
localtunnel(test._fake_port, function(err, tunnel) {
|
|
||||||
assert.ifError(err);
|
|
||||||
assert.ok(new RegExp('^https:\/\/.*localtunnel.me' + '$').test(tunnel.url));
|
|
||||||
test._fake_url = tunnel.url;
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test('query localtunnel server w/ ident', function(done) {
|
|
||||||
var uri = test._fake_url;
|
|
||||||
var parsed = url.parse(uri);
|
|
||||||
|
|
||||||
var opt = {
|
|
||||||
host: parsed.host,
|
|
||||||
port: 443,
|
|
||||||
headers: {
|
|
||||||
host: parsed.hostname
|
|
||||||
},
|
|
||||||
path: '/'
|
|
||||||
};
|
|
||||||
|
|
||||||
var req = https.request(opt, function(res) {
|
|
||||||
res.setEncoding('utf8');
|
|
||||||
var body = '';
|
|
||||||
|
|
||||||
res.on('data', function(chunk) {
|
|
||||||
body += chunk;
|
|
||||||
});
|
|
||||||
|
|
||||||
res.on('end', function() {
|
|
||||||
assert(/.*[.]localtunnel[.]me/.test(body), body);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
req.end();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('request specific domain', function(done) {
|
|
||||||
localtunnel(test._fake_port, { subdomain: 'abcd' }, function(err, tunnel) {
|
|
||||||
assert.ifError(err);
|
|
||||||
assert.ok(new RegExp('^https:\/\/abcd.localtunnel.me' + '$').test(tunnel.url));
|
|
||||||
tunnel.close();
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
suite('--local-host localhost');
|
|
||||||
|
|
||||||
test('setup localtunnel client', function(done) {
|
|
||||||
var opt = {
|
|
||||||
local_host: 'localhost'
|
|
||||||
};
|
|
||||||
localtunnel(test._fake_port, opt, function(err, tunnel) {
|
|
||||||
assert.ifError(err);
|
|
||||||
assert.ok(new RegExp('^https:\/\/.*localtunnel.me' + '$').test(tunnel.url));
|
|
||||||
test._fake_url = tunnel.url;
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test('override Host header with local-host', function(done) {
|
|
||||||
var uri = test._fake_url;
|
|
||||||
var parsed = url.parse(uri);
|
|
||||||
|
|
||||||
var opt = {
|
|
||||||
host: parsed.host,
|
|
||||||
port: 443,
|
|
||||||
headers: {
|
|
||||||
host: parsed.hostname
|
|
||||||
},
|
|
||||||
path: '/'
|
|
||||||
};
|
|
||||||
|
|
||||||
var req = https.request(opt, function(res) {
|
|
||||||
res.setEncoding('utf8');
|
|
||||||
var body = '';
|
|
||||||
|
|
||||||
res.on('data', function(chunk) {
|
|
||||||
body += chunk;
|
|
||||||
});
|
|
||||||
|
|
||||||
res.on('end', function() {
|
|
||||||
assert.equal(body, 'localhost');
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
req.end();
|
|
||||||
});
|
|
||||||
|
|
||||||
suite('--local-host 127.0.0.1');
|
|
||||||
|
|
||||||
test('setup localtunnel client', function(done) {
|
|
||||||
var opt = {
|
|
||||||
local_host: '127.0.0.1'
|
|
||||||
};
|
|
||||||
localtunnel(test._fake_port, opt, function(err, tunnel) {
|
|
||||||
assert.ifError(err);
|
|
||||||
assert.ok(new RegExp('^https:\/\/.*localtunnel.me' + '$').test(tunnel.url));
|
|
||||||
test._fake_url = tunnel.url;
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test('override Host header with local-host', function(done) {
|
|
||||||
var uri = test._fake_url;
|
|
||||||
var parsed = url.parse(uri);
|
|
||||||
|
|
||||||
var opt = {
|
|
||||||
host: parsed.host,
|
|
||||||
port: 443,
|
|
||||||
headers: {
|
|
||||||
host: parsed.hostname
|
|
||||||
},
|
|
||||||
path: '/'
|
|
||||||
};
|
|
||||||
|
|
||||||
var req = https.request(opt, function(res) {
|
|
||||||
res.setEncoding('utf8');
|
|
||||||
var body = '';
|
|
||||||
|
|
||||||
res.on('data', function(chunk) {
|
|
||||||
body += chunk;
|
|
||||||
});
|
|
||||||
|
|
||||||
res.on('end', function() {
|
|
||||||
assert.equal(body, '127.0.0.1');
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
req.end();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('send chunked request', function(done) {
|
|
||||||
var uri = test._fake_url;
|
|
||||||
var parsed = url.parse(uri);
|
|
||||||
|
|
||||||
var opt = {
|
|
||||||
host: parsed.host,
|
|
||||||
port: 443,
|
|
||||||
headers: {
|
|
||||||
host: parsed.hostname,
|
|
||||||
'Transfer-Encoding': 'chunked'
|
|
||||||
},
|
|
||||||
path: '/'
|
|
||||||
};
|
|
||||||
|
|
||||||
var req = https.request(opt, function(res) {
|
|
||||||
res.setEncoding('utf8');
|
|
||||||
var body = '';
|
|
||||||
|
|
||||||
res.on('data', function(chunk) {
|
|
||||||
body += chunk;
|
|
||||||
});
|
|
||||||
|
|
||||||
res.on('end', function() {
|
|
||||||
assert.equal(body, '127.0.0.1');
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
req.end(require('crypto').randomBytes(1024 * 8).toString('base64'));
|
|
||||||
});
|
|
||||||
311
yarn.lock
Normal file
311
yarn.lock
Normal file
@@ -0,0 +1,311 @@
|
|||||||
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||||
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
ansi-regex@^4.1.0:
|
||||||
|
version "4.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997"
|
||||||
|
integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==
|
||||||
|
|
||||||
|
ansi-styles@^3.2.0:
|
||||||
|
version "3.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
|
||||||
|
integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==
|
||||||
|
dependencies:
|
||||||
|
color-convert "^1.9.0"
|
||||||
|
|
||||||
|
axios@0.19.0:
|
||||||
|
version "0.19.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.0.tgz#8e09bff3d9122e133f7b8101c8fbdd00ed3d2ab8"
|
||||||
|
integrity sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==
|
||||||
|
dependencies:
|
||||||
|
follow-redirects "1.5.10"
|
||||||
|
is-buffer "^2.0.2"
|
||||||
|
|
||||||
|
camelcase@^5.0.0:
|
||||||
|
version "5.3.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
|
||||||
|
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
|
||||||
|
|
||||||
|
cliui@^5.0.0:
|
||||||
|
version "5.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5"
|
||||||
|
integrity sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==
|
||||||
|
dependencies:
|
||||||
|
string-width "^3.1.0"
|
||||||
|
strip-ansi "^5.2.0"
|
||||||
|
wrap-ansi "^5.1.0"
|
||||||
|
|
||||||
|
color-convert@^1.9.0:
|
||||||
|
version "1.9.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
|
||||||
|
integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==
|
||||||
|
dependencies:
|
||||||
|
color-name "1.1.3"
|
||||||
|
|
||||||
|
color-name@1.1.3:
|
||||||
|
version "1.1.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
|
||||||
|
integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=
|
||||||
|
|
||||||
|
commander@0.6.1:
|
||||||
|
version "0.6.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/commander/-/commander-0.6.1.tgz#fa68a14f6a945d54dbbe50d8cdb3320e9e3b1a06"
|
||||||
|
integrity sha1-+mihT2qUXVTbvlDYzbMyDp47GgY=
|
||||||
|
|
||||||
|
commander@2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/commander/-/commander-2.0.0.tgz#d1b86f901f8b64bd941bdeadaf924530393be928"
|
||||||
|
integrity sha1-0bhvkB+LZL2UG96tr5JFMDk76Sg=
|
||||||
|
|
||||||
|
debug@*, debug@4.1.1:
|
||||||
|
version "4.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791"
|
||||||
|
integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==
|
||||||
|
dependencies:
|
||||||
|
ms "^2.1.1"
|
||||||
|
|
||||||
|
debug@=3.1.0:
|
||||||
|
version "3.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
|
||||||
|
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
|
||||||
|
dependencies:
|
||||||
|
ms "2.0.0"
|
||||||
|
|
||||||
|
decamelize@^1.2.0:
|
||||||
|
version "1.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
|
||||||
|
integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=
|
||||||
|
|
||||||
|
diff@1.0.7:
|
||||||
|
version "1.0.7"
|
||||||
|
resolved "https://registry.yarnpkg.com/diff/-/diff-1.0.7.tgz#24bbb001c4a7d5522169e7cabdb2c2814ed91cf4"
|
||||||
|
integrity sha1-JLuwAcSn1VIhaefKvbLCgU7ZHPQ=
|
||||||
|
|
||||||
|
emoji-regex@^7.0.1:
|
||||||
|
version "7.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156"
|
||||||
|
integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==
|
||||||
|
|
||||||
|
find-up@^3.0.0:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73"
|
||||||
|
integrity sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==
|
||||||
|
dependencies:
|
||||||
|
locate-path "^3.0.0"
|
||||||
|
|
||||||
|
follow-redirects@1.5.10:
|
||||||
|
version "1.5.10"
|
||||||
|
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a"
|
||||||
|
integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==
|
||||||
|
dependencies:
|
||||||
|
debug "=3.1.0"
|
||||||
|
|
||||||
|
get-caller-file@^2.0.1:
|
||||||
|
version "2.0.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
|
||||||
|
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
|
||||||
|
|
||||||
|
glob@3.2.3:
|
||||||
|
version "3.2.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/glob/-/glob-3.2.3.tgz#e313eeb249c7affaa5c475286b0e115b59839467"
|
||||||
|
integrity sha1-4xPusknHr/qlxHUoaw4RW1mDlGc=
|
||||||
|
dependencies:
|
||||||
|
graceful-fs "~2.0.0"
|
||||||
|
inherits "2"
|
||||||
|
minimatch "~0.2.11"
|
||||||
|
|
||||||
|
graceful-fs@~2.0.0:
|
||||||
|
version "2.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-2.0.3.tgz#7cd2cdb228a4a3f36e95efa6cc142de7d1a136d0"
|
||||||
|
integrity sha1-fNLNsiiko/Nule+mzBQt59GhNtA=
|
||||||
|
|
||||||
|
growl@1.7.x:
|
||||||
|
version "1.7.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/growl/-/growl-1.7.0.tgz#de2d66136d002e112ba70f3f10c31cf7c350b2da"
|
||||||
|
integrity sha1-3i1mE20ALhErpw8/EMMc98NQsto=
|
||||||
|
|
||||||
|
inherits@2:
|
||||||
|
version "2.0.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
|
||||||
|
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
|
||||||
|
|
||||||
|
is-buffer@^2.0.2:
|
||||||
|
version "2.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.3.tgz#4ecf3fcf749cbd1e472689e109ac66261a25e725"
|
||||||
|
integrity sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==
|
||||||
|
|
||||||
|
is-fullwidth-code-point@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f"
|
||||||
|
integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=
|
||||||
|
|
||||||
|
jade@0.26.3:
|
||||||
|
version "0.26.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/jade/-/jade-0.26.3.tgz#8f10d7977d8d79f2f6ff862a81b0513ccb25686c"
|
||||||
|
integrity sha1-jxDXl32NefL2/4YqgbBRPMslaGw=
|
||||||
|
dependencies:
|
||||||
|
commander "0.6.1"
|
||||||
|
mkdirp "0.3.0"
|
||||||
|
|
||||||
|
locate-path@^3.0.0:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e"
|
||||||
|
integrity sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==
|
||||||
|
dependencies:
|
||||||
|
p-locate "^3.0.0"
|
||||||
|
path-exists "^3.0.0"
|
||||||
|
|
||||||
|
lru-cache@2:
|
||||||
|
version "2.7.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-2.7.3.tgz#6d4524e8b955f95d4f5b58851ce21dd72fb4e952"
|
||||||
|
integrity sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=
|
||||||
|
|
||||||
|
minimatch@~0.2.11:
|
||||||
|
version "0.2.14"
|
||||||
|
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-0.2.14.tgz#c74e780574f63c6f9a090e90efbe6ef53a6a756a"
|
||||||
|
integrity sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=
|
||||||
|
dependencies:
|
||||||
|
lru-cache "2"
|
||||||
|
sigmund "~1.0.0"
|
||||||
|
|
||||||
|
mkdirp@0.3.0:
|
||||||
|
version "0.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.3.0.tgz#1bbf5ab1ba827af23575143490426455f481fe1e"
|
||||||
|
integrity sha1-G79asbqCevI1dRQ0kEJkVfSB/h4=
|
||||||
|
|
||||||
|
mkdirp@0.3.5:
|
||||||
|
version "0.3.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.3.5.tgz#de3e5f8961c88c787ee1368df849ac4413eca8d7"
|
||||||
|
integrity sha1-3j5fiWHIjHh+4TaN+EmsRBPsqNc=
|
||||||
|
|
||||||
|
mocha@~1.17.0:
|
||||||
|
version "1.17.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/mocha/-/mocha-1.17.1.tgz#7f7671d68526d074b7bae660c9099f87e0ea1ccb"
|
||||||
|
integrity sha1-f3Zx1oUm0HS3uuZgyQmfh+DqHMs=
|
||||||
|
dependencies:
|
||||||
|
commander "2.0.0"
|
||||||
|
debug "*"
|
||||||
|
diff "1.0.7"
|
||||||
|
glob "3.2.3"
|
||||||
|
growl "1.7.x"
|
||||||
|
jade "0.26.3"
|
||||||
|
mkdirp "0.3.5"
|
||||||
|
|
||||||
|
ms@2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
|
||||||
|
integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=
|
||||||
|
|
||||||
|
ms@^2.1.1:
|
||||||
|
version "2.1.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
|
||||||
|
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
|
||||||
|
|
||||||
|
openurl@1.1.1:
|
||||||
|
version "1.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/openurl/-/openurl-1.1.1.tgz#3875b4b0ef7a52c156f0db41d4609dbb0f94b387"
|
||||||
|
integrity sha1-OHW0sO96UsFW8NtB1GCduw+Us4c=
|
||||||
|
|
||||||
|
p-limit@^2.0.0:
|
||||||
|
version "2.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.1.tgz#aa07a788cc3151c939b5131f63570f0dd2009537"
|
||||||
|
integrity sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==
|
||||||
|
dependencies:
|
||||||
|
p-try "^2.0.0"
|
||||||
|
|
||||||
|
p-locate@^3.0.0:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4"
|
||||||
|
integrity sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==
|
||||||
|
dependencies:
|
||||||
|
p-limit "^2.0.0"
|
||||||
|
|
||||||
|
p-try@^2.0.0:
|
||||||
|
version "2.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6"
|
||||||
|
integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==
|
||||||
|
|
||||||
|
path-exists@^3.0.0:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515"
|
||||||
|
integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=
|
||||||
|
|
||||||
|
require-directory@^2.1.1:
|
||||||
|
version "2.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
|
||||||
|
integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I=
|
||||||
|
|
||||||
|
require-main-filename@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b"
|
||||||
|
integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==
|
||||||
|
|
||||||
|
set-blocking@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7"
|
||||||
|
integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc=
|
||||||
|
|
||||||
|
sigmund@~1.0.0:
|
||||||
|
version "1.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590"
|
||||||
|
integrity sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=
|
||||||
|
|
||||||
|
string-width@^3.0.0, string-width@^3.1.0:
|
||||||
|
version "3.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961"
|
||||||
|
integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==
|
||||||
|
dependencies:
|
||||||
|
emoji-regex "^7.0.1"
|
||||||
|
is-fullwidth-code-point "^2.0.0"
|
||||||
|
strip-ansi "^5.1.0"
|
||||||
|
|
||||||
|
strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0:
|
||||||
|
version "5.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae"
|
||||||
|
integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==
|
||||||
|
dependencies:
|
||||||
|
ansi-regex "^4.1.0"
|
||||||
|
|
||||||
|
which-module@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"
|
||||||
|
integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=
|
||||||
|
|
||||||
|
wrap-ansi@^5.1.0:
|
||||||
|
version "5.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09"
|
||||||
|
integrity sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==
|
||||||
|
dependencies:
|
||||||
|
ansi-styles "^3.2.0"
|
||||||
|
string-width "^3.0.0"
|
||||||
|
strip-ansi "^5.0.0"
|
||||||
|
|
||||||
|
y18n@^4.0.0:
|
||||||
|
version "4.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b"
|
||||||
|
integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==
|
||||||
|
|
||||||
|
yargs-parser@^13.1.1:
|
||||||
|
version "13.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.1.tgz#d26058532aa06d365fe091f6a1fc06b2f7e5eca0"
|
||||||
|
integrity sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==
|
||||||
|
dependencies:
|
||||||
|
camelcase "^5.0.0"
|
||||||
|
decamelize "^1.2.0"
|
||||||
|
|
||||||
|
yargs@13.3.0:
|
||||||
|
version "13.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.0.tgz#4c657a55e07e5f2cf947f8a366567c04a0dedc83"
|
||||||
|
integrity sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==
|
||||||
|
dependencies:
|
||||||
|
cliui "^5.0.0"
|
||||||
|
find-up "^3.0.0"
|
||||||
|
get-caller-file "^2.0.1"
|
||||||
|
require-directory "^2.1.1"
|
||||||
|
require-main-filename "^2.0.0"
|
||||||
|
set-blocking "^2.0.0"
|
||||||
|
string-width "^3.0.0"
|
||||||
|
which-module "^2.0.0"
|
||||||
|
y18n "^4.0.0"
|
||||||
|
yargs-parser "^13.1.1"
|
||||||
Reference in New Issue
Block a user