localtunnel Gem version

Ruby gem wrapping the localtunnel npm package.

Installation

Add this line to your application's Gemfile:

gem 'localtunnel'

And then execute:

$ bundle install

Lastly, install the localtunnel npm package and ensure that it is available in your PATH:

$ npm install -g localtunnel

Usage

A basic example:

require 'localtunnel'

Localtunnel::Client.start(port: 3000)

Localtunnel::Client.running? # => true

Localtunnel::Client.url # => https://pnevcucqgb.localtunnel.me

Localtunnel::Client.stop

Extra options can also be specified:

Localtunnel::Client.start(
  port: 3000,
  subdomain: 'hello',
  remote_host: 'http://my-domain-1.com',
  local_host: 'http://my-domain-2.com'
)

Related

It is also worth checking out ngrok-tunnel, a gem that is similar in function to this one and served as its inspiration.