Tunnel

Tunnel lets you expose local servers to internet securely - ngrok alternative, compatible with SSH client.

  • SSH between your server and remote host
  • TLS between client and remote host

Tunnel can be created using SSH or Tunnel client

Use Cases

  • SSH to your home machine e.g. Raspberry Pi from internet
  • Self-host applications at home and access them over internet
  • Public URLs to share with clients or co-workers
  • Directly share files from your computer

Installation

Via Binary

Via Homebrew (macOS)

brew install tunnel

Via Scoop (Windows)

scoop install tunnel

Usage

If you are using the Tunnel client with custom domain, subdomain or port you would need to create a config file in your home directory:

$HOME/.tunnel/config.yaml

api_key: <API_KEY>

Replace <API_KEY> with your value

Forward HTTP/HTTPS traffic

Using Tunnel client

The above tunnel can also be created using the Tunnel client:

tunnel 8080

You can also use a reserved sudomain registered from the Dashboard:

tunnel --name <CONFIGURATION_NAME> 8080

Replace <CONFIGURATION_NAME> with your value

Using SSH

ssh -R 443:localhost:8080 labstack.me

In the example above, -R option requests the server to route HTTP traffic from 443 port on remote host to port 8080 on local host. Client can access the local server using a randomly generated subdomain of labstack.me e.g. https://ro8hqk97obhk.max.labstack.me.

To use a reserved sudomain:

ssh -R 80:localhost:8080 name=<CONFIGURATION_NAME>,key=<API_KEY>@<HOST>

Replace <CONFIGURATION_NAME>, <API_KEY> & <HOST> with your values

TCP Traffic

Using Tunnel client

tunnel --tcp 1883

For TLS use --tls flag instead

Using SSH

ssh -R 0:localhost:1883 labstack.me

To route TCP traffic use port 0 and any unused port will be assigned. Client can access the local server using a provided subdomain of labstack.me and assigned port e.g. tcp://zoe.labstack.me:18830. To setup TLS connection, provide user as tls=true e.g. ssh -R 0:localhost:1883 [email protected].

Auto Reconnect

If tunnel is disconnected due to network issues, it will try to reconnect. For SSH, you can use autossh to maintain a persistent connection.

© 2018 LabStack. All Rights Reserved.