Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

3 anos atrás
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # localtunnel
  2. [![Build Status](https://travis-ci.org/localtunnel/localtunnel.svg?branch=master)](https://travis-ci.org/localtunnel/localtunnel)
  3. 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.
  4. Great for working with browser testing tools like browserling or external api callback services like twilio which require a public url for callbacks.
  5. ## installation ##
  6. ```
  7. npm install -g localtunnel
  8. ```
  9. This will install the localtunnel module globally and add the 'lt' client cli tool to your PATH.
  10. ## use ##
  11. Assuming your local server is running on port 8000, just use the ```lt``` command to start the tunnel.
  12. ```
  13. lt --port 8000
  14. ```
  15. 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!
  16. You can restart your local server all you want, ```lt``` is smart enough to detect this and reconnect once it is back.
  17. ### arguments
  18. Below are some common arguments. See `lt --help` for additional arguments
  19. * `--subdomain` request a named subdomain on the localtunnel server (default is random characters)
  20. * `--local-host` proxy to a hostname other than localhost
  21. You may also specify arguments via env variables. E.x.
  22. ```
  23. PORT=3000 lt
  24. ```
  25. ## API ##
  26. The localtunnel client is also usable through an API (for test integration, automation, etc)
  27. ### localtunnel(port [,opts], fn)
  28. 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`.
  29. ```javascript
  30. var localtunnel = require('localtunnel');
  31. var tunnel = localtunnel(port, function(err, tunnel) {
  32. if (err) ...
  33. // the assigned public url for your tunnel
  34. // i.e. https://abcdefgjhij.localtunnel.me
  35. tunnel.url;
  36. });
  37. tunnel.on('close', function() {
  38. // tunnels are closed
  39. });
  40. ```
  41. ### opts
  42. * `subdomain` A *string* value requesting a specific subdomain on the proxy server. **Note** You may not actually receive this name depending on availability.
  43. * `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.
  44. ### Tunnel
  45. The `tunnel` instance returned to your callback emits the following events
  46. |event|args|description|
  47. |----|----|----|
  48. |request|info|fires when a request is processed by the tunnel, contains _method_ and _path_ fields|
  49. |error|err|fires when an error happens on the tunnel|
  50. |close||fires when the tunnel has closed|
  51. The `tunnel` instance has the following methods
  52. |method|args|description|
  53. |----|----|----|
  54. |close||close the tunnel|
  55. ## other clients ##
  56. Clients in other languages
  57. *go* [gotunnelme](https://github.com/NoahShen/gotunnelme)
  58. *go* [go-localtunnel](https://github.com/localtunnel/go-localtunnel)
  59. ## server ##
  60. See [localtunnel/server](//github.com/localtunnel/server) for details on the server that powers localtunnel.
  61. ## License ##
  62. MIT