Giter Site home page Giter Site logo

tunnelmole-client's Introduction

Tunnelmole

Tunnelmole

Tunnelmole is a simple tool to give your locally running HTTP(s) servers a public URL. For example, you could get a public URL for

  • A web server
  • A Docker container
  • An API
  • A React or node application
  • A static website

So, you could have your application running locally on port 8080, then by running tmole 8080 you could have a URL such as https://df34.tunnelmole.net routing to your locally running application.

Quick Demo

Getting a Public URL for the Tunnelmole Website, which is running locally Tunnelmole Example

Tunnelmole has been compared to a similar tool known as ngrok, but is open source.

If you are using the default configuration you will get a HTTPs URL for free.

Heres what you could do with your new public URL

  • Automate your life. With a public URL, IFTTT and other automation services can send you webhooks which your code can then react to
  • Test and debug webhooks locally without stubbing requests. Set a breakpoint, then trigger the webhook provider to hit your URL
  • Use your phone to test the mobile version of your site. A real device will always be better than using an emulator or devtools to do mobile testing
  • Test advanced HTTPs only features such as Web Notifications and PWA's locally
  • Cross device testing with real devices. Hop on another computer or device running the same or a different OS, then hit the public URL Tunnelmole generated for you
  • Share it with anyone over the internet such as a friend, colleague or client to show off your work

Installation

There are a couple of ways to install Tunnelmole.

If you have NodeJS 16.10 or later, you can install Tunnelmole by running

sudo npm install -g tunnelmole

Alternatively you can install the latest precompiled binary for your platform. This has the right version of Node built in. You don't need any specific version of Node installed for this approach

Linux, Mac and Windows Subsystem for Linux

Copy and paste the following into a terminal:

curl -O https://install.tunnelmole.com/xD345/install && sudo bash install

The script will detect your OS and install the right version.

Windows

  1. Download tmole.exe
  2. Put it somewhere in your PATH.

I'd like to have the install script for Linux and Mac also working in Cygwin and Mingw. Let me know if you're willing to help test!.

Install with NPM

To install Tunnelmole with NPM you need to have NodeJS installed. If not, get it from (https://nodejs.org/).

npm install -g tunnelmole

Using Tunnelmole

  • Start your web application locally and note down the port number its listening on
  • Run tmole <port number>, replacing <port number> with your applications port number. For example, if your application listens on port 8080, run tmole 8080.

Here's what it should look like

$ tmole 8080
http://evgtkh-ip-49-145-166-122.tunnelmole.net is forwarding to localhost:8080
https://evgtkh-ip-49-145-166-122.tunnelmole.net is forwarding to localhost:8080

Now, just go to either one of the URLs shown with your web browser.

You can also use another device, for example try hitting one of the URLs with your phones browser or a different computer.

The URLs are public - this means you can also share them with collaborators and others over the internet.

Custom subdomain

Sometimes, it can be useful to have a domain that does not change frequently. To use a custom subdoman run tmole 8080 as <yourdomain>.tunnelmole.net.

If you are using the hosted service (which is the default) and you want to use a custom subdomain you'll need to purchase a subscription Learn More.

Otherwise, you can self host. To learn more go to the Tunnelmole Service GitHub repo.

Integrating with NodeJS and TypeScript projects with NPM

Tunnelmole is available as an NPM dependency for integration with NodeJS and TypeScript projects.

Install as an npm dependency

To integrate tunnelmole with your project you first need to install it as an NPM dependency.

npm install --save tunnelmole

Starting tunnelmole using code

First import tunnelmole. Both ES and CommonJS modules are supported.

Importing tunnelmole as an ES module

import { tunnelmole } from 'tunnelmole';

Importing tunnelmole as a CommonJS module

const tunnelmole = require('tunnelmole/cjs');

Once the module is imported you can start tunnelmole with the code below, changing port 3000 to the port your application listens on if it is different.

const url = tunnelmole({
    port: 3000
});
// url = https://idsq6j-ip-157-211-195-169.tunnelmole.net

Tunnelmole will start in the background and you'll see output in the console log similar to the Tunnelmole command line application which will include the public URLs that now point to your application. The function is async and won't block execution of the rest of your code.

If you want to use a custom subdomain, you could also pass the domain as an option.

const url = tunnelmole({
    port: 3000,
    domain: '<your tunnelmole domain e.g. mysite.tunnelmole.net>'
});
// url = mydomain.tunnelmole.net

Again if you are using the hosted service (which is the default) and you want to use a custom subdomain you'll need to purchase a subscription Learn More.

Otherwise, you can self host. To learn more about this option go to the Tunnelmole Service GitHub repo.

Suppress output/logs

To suppress the initial output with the URLs, set the environment variable TUNNELMOLE_QUIET_MODE=1 somewhere in your environment. This might be useful in a CI/CD environment or in other scripts.

Using Tunnelmole with NPM scripts

Installing Tunnelmole as an NPM dependency will make the following executables available in your project:

node_modules/.bin/tmole
node_modules/.bin/tunnelmole

They both work identically to the Tunnelmole command line application.

You can run them manually in the same way as the command line application (for example node node_modules/.bin/tmole 3000), but its far more convenient to integrate them with NPM scripts in package.json. This way, you can automate starting your application and generating a public URL with a single command. For example:

{
    "name": "myapp",
    "version": "0.0.1",
    "scripts": {
        "start": "dist/index.js",
        "start-public": "npm run start && tmole 3000"
    }
}

In this example, npm run start-public will simultaneously start your application and get tunnelmole to generate public URLs tunneling to port 3000. Replace port 3000 with the port your application listens on if it is different. You will see the public URLs in the command line output.

This allows you to start your application and get a public URL with a single command, instead of needing to run two commands in separate terminals.

Building from source

Prerequisites

  • TypeScript 4.4 or later
  • Node 15 or later

Install the dependencies with npm

Run npm install

Copy the example config

cp config-instance.example.ts config-instance.ts

The default settings are fine unless you want to self host your own tunnelmole service, in which case you'll need to modify the config to point to your server.

Start Tunnelmole

To start Tunnelmole, run npm start.

This does a few things for you automatically:

  • First, the code will compile
  • Tunnelmole will then start
  • Every time you make changes, the code will recompile and Tunnelmole will automatically restart. This saves you time as you won't need to manually recompile and restart Tunnelmole yourself. This feature is also known as Hot Reload.

Alternatively you can invoke Tunnelmole manually with node dist/bin/tunnelmole.js <port number to forward to> after compiling the code with npm run build.

Debugging

This project has sourcemaps enabled, so you can set breakpoints in the TypeScript .ts files and they should behave normally.

If Tunnelmole crashes and you get a Stack Trace it will refer to the TypeScript files and line numbers which should make tracking down problematic code easier.

To set up debugging for Visual Studio Code, copy over the example config.

cp .vscode/launch.json.example .vscode/launch.json

Once this is done, run "Launch Tunnelmole" from the Run and Debug menu.

While debugging, hot reload is not supported as you'd loose your debug connection each time Tunnelmole restarts. So for every change, you will need to recompile the code (i.e. with npm run build) and then restart the debugger.

You can optionally run npm run watch to automatically recompile code as you make changes.

By default, Launch Tunnelmole invokes Tunnelmole to forward to port 8001 locally. You can change this by changing the port in the .vscode/launch.json config under the "args" section.

How it works

How Tunnelmole Works

Tunnelmole sets up a persistent Websocket connection between your device and a host machine running the tunnelmole service. By default, this is the hosted tunnlemole service at https://tunnelmole.com but you can self host.

As requests come in to the public URL, these requests are sent back through the Websocket connection to the client running on your machine.

The client then forwards on the request to your locally running web server.

Responses are handled in reverse. Your client forwards them to the Tunnelmole service, which then serves them up at the public URL.

Telemetry

To help improve the developer experience of Tunnelmole, some anonymized Telemetry data is collected by default.

For example

  • Your NodeJS version and OS
  • Crash reports which may include stack traces to assist in detecting and debugging unforseen issues that were not detected during testing (especially the "it worked on my machine" type).

To disable the telemetery, add the variable TUNNELMOLE_TELEMETRY=0 to your environment.

On Linux and Mac, to opt out for a single run of Tunnelmole you could put this in front of the tmole command, for example

TUNNELMOLE_TELEMETRY=0 tmole 80

To opt out by default:

  • On Linux or Mac add export TUNNELMOLE_TELEMETRY=0 to your shells startup script, usually .bashrc or .zshrc but it will be different if you are not using bash or zsh as your shell. Then log out and back in to apply the changes.
  • On Windows add TUNNELMOLE_TELEMETRY=0 to your environment variables using the System utility https://www.computerhope.com/issues/ch000549.htm. Then restart your computer to apply the changes.

Contributing

There is no big company behind Tunnelmole and currently there is only one maintainer so any help is greatly appreciated!.

If you'd like a bug fixed or missing feature added, the fastest way to make that happen is to implement the changes yourself.

This repo has a few features to help with your developer experience including sample debugging configuration and hot reload.

Here are some different ways you can help

  • Help with testing Tunnelmole. Install the latest binary or build the latest source release and do your best to break it. If you're able to, create an issue.
  • Spreading the word. As previously mentioned, there is no big company or marketing department. That leaves it up to you to help others by introducing them to Tunnelmole. Sharing Tunnelmole on social media sites and creating blog articles will help you look good and help other developers.
  • Fixing bugs
  • Making feature requests. To do this, create a GitHub issue and describe the feature you think Tunnelmole should have
  • Implementing features

For any code changes, you will need to fork this repo and submit a PR. If you've never done this before, GitHub has a very good guide here.

FAQs

Is Tunnelmole fully open source?

Both the Tunnelmole client and server are fully open source.

You are free to self host or use our hosted service.

We welcome issue reports and PRs from the community.

Feel free to look over the code and see exactly what Tunnelmole is doing before running it.

The Tunnelmole client is licensed under the MIT license. The service is licensed under the Gnu Affero General Public License, version 3.

Does Tunnemole hide my IP?

In the past the Tunnelmole service did hide IP addresses. Unfortunately this encouraged bad actors to use the service. They would tunnel phishing sites through the service, then the abuse reports would get sent to my hosting provider instead of theirs.

Because of this, Tunnelmole now adds an X-Forwarded-For header with your IP in every response. So you can't use the Tunnelmole hosted service to hide your origin server. For the randomly generated URLs your IP is also added to the URL itself.

However, you can always self host Tunnelmole and remove the code that adds this header if you want. This would allow you to hide your origin server. You'll then be responsible for securing your service. The IP of the server you self host on will still be visible.

How can I help

Read the above "Contributing" section to learn how to contribute.

Links and resources

Uninstallation

  • If you installed with npm, run npm uninstall -g tunnelmole
  • On Linux or Mac, run whereis tmole, then whereis tunnelmole and delete the both files shown
  • On Windows, delete the tmole.exe file you downloaded

tunnelmole-client's People

Contributors

blaircurrey avatar edgardmessias avatar mcheshkov avatar robbie-cahill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tunnelmole-client's Issues

Using tmole as globally installed package

Hello, I have tried installing tunnelmole client as a global package (like this). After trying to execute the tool, I got the following error:

> tmole 3000

node:fs:585
  handleErrorFromBinding(ctx);
  ^

Error: ENOENT: no such file or directory, open 'D:\/package.json'
    at Object.openSync (node:fs:585:3)
    at Object.readFileSync (node:fs:453:35)
    at file:///D:/Programs/Development/NodeVersionManager/v16.16.0/node_modules/tunnelmole/dist/src/node/packageJson.js:3:35
    at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
    at async loadESM (node:internal/process/esm_loader:88:5)
    at async handleMainPromise (node:internal/modules/run_main:61:12) {
  errno: -4058,
  syscall: 'open',
  code: 'ENOENT',
  path: 'D:\\/package.json'
}

I am using Windows 10, and ran the script from a Windows PS terminal while I was in a random folder (root of my secondary drive).
It seems like the tmole client expects the existence of package.json in a directory where it is being run.

(source)

const { name, version } = packageJson;

program
    .name(name)
    .usage(...)
    ...

Why does it require the existence of the JSON file? Or is this unintended and should extract name and version from the package.json located in the tunnelmole/dist?

Thanks for clarification!

ARM support ?

Hello:) Trying to run tunnelmole on a Jetson Nano Developper Kit running Ubuntu 18.04. Seems to be because binary is compiled for x86 and no binary is provided for ARM. Could it ?

Getting the following error :

user@pathtoserver:/usr/local/bin$ tmole 8888
-bash: /usr/local/bin/tmole: cannot execute binary file: Exec format error

Some more eslint errors

tunnelmole-client git:(main) npm run lint

> [email protected] lint
> eslint . --ext .ts


/home/robbie/projects/tunnelmole-client/src/cli/dispatch-command.ts
   3:10  warning  'setApiKey' is defined but never used     @typescript-eslint/no-unused-vars
  10:54  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/robbie/projects/tunnelmole-client/src/message-handlers/forwarded-request.ts
  37:13  error    Do not use "@ts-ignore" because it alters compilation errors  @typescript-eslint/ban-ts-comment
  58:34  warning  Unexpected any. Specify a different type                      @typescript-eslint/no-explicit-any

/home/robbie/projects/tunnelmole-client/src/message-handlers/generic-message-handler.ts
  7:53   warning  'message' is defined but never used                      @typescript-eslint/no-unused-vars
  7:62   warning  Unexpected any. Specify a different type                 @typescript-eslint/no-explicit-any
  7:67   warning  'websocket' is defined but never used                    @typescript-eslint/no-unused-vars
  7:95   warning  'options' is defined but never used                      @typescript-eslint/no-unused-vars
  7:113  error    Unexpected empty async function 'genericMessageHandler'  @typescript-eslint/no-empty-function

/home/robbie/projects/tunnelmole-client/src/message-handlers/hostname-already-taken.ts
  4:61  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  4:66  warning  'websocket' is defined but never used     @typescript-eslint/no-unused-vars
  4:94  warning  'options' is defined but never used       @typescript-eslint/no-unused-vars

/home/robbie/projects/tunnelmole-client/src/message-handlers/invalid-subscription.ts
  5:82   warning  'websocket' is defined but never used  @typescript-eslint/no-unused-vars
  5:110  warning  'options' is defined but never used    @typescript-eslint/no-unused-vars

/home/robbie/projects/tunnelmole-client/src/messages/forwarded-response-message.ts
  8:14  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

Certificate expired on *.tunnelmole.com

tmole xxxx Fails to start because the certificate on wildcard subdomains is expired.

One of the failing URLs: https://service.tunnelmole.com/tunnelmole-log-telemetry

Even skipping telemetry with the env variable does not work around the issue. I guess there are other subdomains affected.

npm run build

is run build supposed to build the client executable?

if not what is the correct process to creating the node.exe for standalone usage

TypeError on Run

I installed tunnelmole via NPM and get this error every time I try to run it.

TypeError: program.name(...).usage is not a function
    at run (file:///C:/Users/user/AppData/Roaming/npm/node_modules/tunnelmole/bin/tunnelmole.ts:29:10)
    at file:///C:/Users/user/AppData/Roaming/npm/node_modules/tunnelmole/bin/tunnelmole.ts:56:11
    at file:///C:/Users/user/AppData/Roaming/npm/node_modules/tunnelmole/bin/tunnelmole.ts:57:3
    at ModuleJob.run (node:internal/modules/esm/module_job:193:25)

I have Node v19.8.1 and NPM 9.6.4.

Python FastAPI not working

As the title described, the service isn't working properly.
I can't access my web service with the generated URL, it keeps showing up [504 Gateway Time-out / nginx/1.18.0 (Ubuntu)]
I just bought the Lite plan and hope this issues can be fixed soon!
Thanks~

The terminal looks fine.
image
But the URL is not working.
image

Can't build tunnelmode-client on Windows.

I am trying to build tunnelmole-service and tunnelmole-client on my local Windows Server 2022 machine. I have node 20.11.0 and TypeScript 5.3.3.

The tunnelmode-service builds without any problem. However, the tunnelmole-client fails during "npm install". I do have the latest code downloaded. I have attached log file. Can you please help me understand what is going on?

Thanks!

2024-01-18T19_25_08_117Z-debug-0.log

Allow the user to get the generated URL

Very nice component - and I like the way you can get multiple generated internet SSL URLs.
I was trying to use it for a code example that demonstrated a tricky mobile security use case.

In ngrok you can write the following type of script to spin up a URL and then use the URL value in automation.
For example to configure components that use the URLs.
A similar feature in your component would also add to its appeal, so thought I'd add a request for that.

ngrok http 80 --log=stdout &
sleep 5
GENERATED_URL=$(curl -s http://localhost:4040/api/tunnels | jq -r '.tunnels[] | select(.proto == "https") | .public_url')

Nothing urgent though - for now I'm writing some script which seems to work alright:

tmole 3000 >mobile_hostnames               &
tmole 3001 >web_hostnames                  &
tmole 8443 >authorization_server_hostnames &
sleep 5

MOBILE_BASE_URL=$(tail -n 1 mobile_hostnames                             | cut -d " " -f1)
WEB_BASE_URL=$(tail -n 1 web_hostnames                                   | cut -d " " -f1)
AUTHORIZATION_SERVER_BASE_URL=$(tail -n 1 authorization_server_hostnames | cut -d " " -f1)

Is there a way to silence logs in the Node package?

I'm starting tunnelmole in Node. It looks that by default it prints out the URLs to the console:

http://foo-ip-99-115-121-181.tunnelmole.net is forwarding to localhost:xxx
https://foo-ip-99-115-121-181.tunnelmole.net is forwarding to localhost:xxx

I can't find a way to silence these logs. Is there a way to silence them? I'm exploring using this in the context of CI tests, where the extra logging can become noisy and distract from diagnosing test failures.

Also, the output of tunnelmole appears to be the https url:

  const httpsURL = await tunnelmole({
    port: 55720
  });

I imagine this may be a much larger design ask, but I wonder if it would be helpful to also return the http link, or, failing that, simply return the non http portion of the URL (i.e., foo-ip-98-116-111-185.tunnelmole.net)

Important

It is unable to do some work compare to ngrok

  1. It not able to fully server novnc from private localport to tunnelmole subdomain .
  • it show the no vnc page , but when we try to move forward in it to open something then the novnc on tmole subdomin show it not connected to backed server.
  • please developed that .
  • where as in ngrok it will easily happend.
  1. Where as ngrok do it .

Client keeps crashing

I'm using the npm tunnel mole client.

using this command:

npm install -g @thgh/tunnelmole && npx tunnelmole --set-api-key 123456789 && npx tunnelmole 32400 as sudomain.website.com

The service I'm proxying is Plex media server. After logging into my plex media server and redirected to home page, the client will just randomly crash.

/usr/local/lib/node_modules/@thgh/tunnelmole/node_modules/ws/lib/sender.js:116
keen_frances-localtunnel-1  |       throw new TypeError('First argument must be a valid error code number');
keen_frances-localtunnel-1  |             ^
keen_frances-localtunnel-1  | TypeError: First argument must be a valid error code number
keen_frances-localtunnel-1  |     at Sender.close (/usr/local/lib/node_modules/@thgh/tunnelmole/node_modules/ws/lib/sender.js:116:13)
keen_frances-localtunnel-1  |     at HostipWebSocket.close (/usr/local/lib/node_modules/@thgh/tunnelmole/node_modules/ws/lib/websocket.js:287:18)
keen_frances-localtunnel-1  |     at WebSocketCloseMessage (file:///usr/local/lib/node_modules/@thgh/tunnelmole/message-handlers.ts:28:38)
keen_frances-localtunnel-1  |     at HostipWebSocket. (file:///usr/local/lib/node_modules/@thgh/tunnelmole/src/tunnelmole.ts:98:9)
keen_frances-localtunnel-1  |     at HostipWebSocket.emit (node:events:526:35)
keen_frances-localtunnel-1  |     at Receiver.receiverOnMessage (/usr/local/lib/node_modules/@thgh/tunnelmole/node_modules/ws/lib/websocket.js:1068:20)
keen_frances-localtunnel-1  |     at Receiver.emit (node:events:514:28)
keen_frances-localtunnel-1  |     at Receiver.dataMessage (/usr/local/lib/node_modules/@thgh/tunnelmole/node_modules/ws/lib/receiver.js:517:14)
keen_frances-localtunnel-1  |     at Receiver.getData (/usr/local/lib/node_modules/@thgh/tunnelmole/node_modules/ws/lib/receiver.js:435:17)
keen_frances-localtunnel-1  |     at Receiver.startLoop (/usr/local/lib/node_modules/@thgh/tunnelmole/node_modules/ws/lib/receiver.js:143:22)

any idea why this is happening?

Support other hosts than localhost

My app is only accessible on 0.0.0.0.

It works fine on ngrok if I use this host but I can't seem to be able to do the same with tunnelmole.

Error: connect ECONNREFUSED 127.0.0.1:8081

I have been testing tunnelmole with the NPM module tunnelmole

OS - Ubuntu
NodeJs - 18.16.1

Code

import { tunnelmole } from 'tunnelmole';

const url = await tunnelmole({
    port: 3000
});

Error

Error: connect ECONNREFUSED 127.0.0.1:8081
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 8081
}

Next.js web server unresponsive, results in 504 gateway timeout

software versions

$ cat /etc/os-release
PRETTY_NAME="Pop!_OS 22.04 LTS"
$ node --version
v18.15.0
$ yarn tunnelmole -V
2.1.10
$ yarn next --version
Next.js v12.3.4

repro

  1. yarn add tunnelmole
  2. yarn next dev & yarn tunnelmole 3000
    ER/AR: tunnel seems to work, the Next.js app loads in browser
  3. yarn build && yarn start & yarn tunnelmole 3000
    AR: Next.js app never loads in browser, eventually 504 gateway timeout

No outup after tmole <port>

Hi, after trying in mac:
curl -s https://tunnelmole.com/sh/install-mac.sh --output install-mac.sh && sudo bash install-mac.sh
tmole 3000
with a React instance running on 192.168.0.50:3000, gets no output, stuck in tmole 3000.
Same in Ubuntu:
curl -s https://tunnelmole.com/sh/install-linux.sh | sudo bash
tmole 3001
running another instance of react in a different machine. Am I doing something wrong? Thanks

Reserved domains

Currently Tunnelmole subdomains only belong to clients for as long as the connection is open.

Associate API keys with subdomains so that once an API key reserves a subdomain, another API key can't use that subdomain unless they unreserve it.

Not working in WSL

I have linux-x64 node-v18.17.1 on the Windows Subsystem for Linux version 2

PORT=8080 node dist/server/entry.js &
sudo npm install -g tunnelmole
tunnelmole 8080

I also tried $ sudo tunnelmole 8080, and server on HOST=0.0.0.0 all error

/usr/lib/node_modules/tunnelmole/node_modules/node-fetch/lib/index.js:1501
                        reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
          ^
FetchError: request to http://localhost:8001/tunnelmole-log-telemetry failed, reason: connect ECONNREFUSED 127.0.0.1:8001
    at ClientRequest.<anonymous> (/usr/lib/node_modules/tunnelmole/node_modules/node-fetch/lib/index.js:1501:11)
    at ClientRequest.emit (node:events:514:28)
    at Socket.socketErrorListener (node:_http_client:501:9)
    at Socket.emit (node:events:514:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)

Automatic reconnect

When developing tunnelmole, the client stops when the server restarts. The client could try to reconnect.

tmole.exe shows no output in cmd

Upon cding into tmole.exe and attempting to get a random public URL forwarding to a specific port, after I press the enter key, the text cursor leaves focus and no output shows. Re-entering the command leads to the same result. See attached image below for more information.

tmole version: 1.0
Windows 11
Command Prompt (administrator)
Installed via Github/npm

image

Expectation:
tmole.exe is supposed to send outputs in the console after the enter key is pressed, this information includes critical information for port forwarding.

**Reality: **
tmole.exe shows no outputs upon pressing the enter key whatsoever, leaves command bar focus and does nothing.

Troubleshooting:

  • I tried running cmd through admin.
  • I tried various different ports.
  • I tried other commands of tmole, those showed up properly.
  • I tried resetting all network adapters.
  • I tried reinstalling the software.

I asked a friend to attempt to reproduce the issue, and he was unable to reproduce the bug as he was able to port-forward successfully, so what am I doing wrong here? It should be easier to operate the software than this. Any assistance and/or bug fixes would be appreciated.

Fixing eslint errors

After adding eslint, there are a few errors based on the default recommended coding standards.

> [email protected] lint
> eslint . --ext .ts


/home/robbie/projects/tunnelmole-client/src/cli/dispatch-command.ts
   3:10  warning  'setApiKey' is defined but never used     @typescript-eslint/no-unused-vars
  10:54  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/robbie/projects/tunnelmole-client/src/message-handlers/forwarded-request.ts
  37:13  error    Do not use "@ts-ignore" because it alters compilation errors  @typescript-eslint/ban-ts-comment
  58:34  warning  Unexpected any. Specify a different type                      @typescript-eslint/no-explicit-any

/home/robbie/projects/tunnelmole-client/src/message-handlers/generic-message-handler.ts
  7:53   warning  'message' is defined but never used                      @typescript-eslint/no-unused-vars
  7:62   warning  Unexpected any. Specify a different type                 @typescript-eslint/no-explicit-any
  7:67   warning  'websocket' is defined but never used                    @typescript-eslint/no-unused-vars
  7:95   warning  'options' is defined but never used                      @typescript-eslint/no-unused-vars
  7:113  error    Unexpected empty async function 'genericMessageHandler'  @typescript-eslint/no-empty-function

/home/robbie/projects/tunnelmole-client/src/message-handlers/hostname-already-taken.ts
  4:61  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  4:66  warning  'websocket' is defined but never used     @typescript-eslint/no-unused-vars
  4:94  warning  'options' is defined but never used       @typescript-eslint/no-unused-vars

/home/robbie/projects/tunnelmole-client/src/message-handlers/invalid-subscription.ts
  5:82   warning  'websocket' is defined but never used  @typescript-eslint/no-unused-vars
  5:110  warning  'options' is defined but never used    @typescript-eslint/no-unused-vars

/home/robbie/projects/tunnelmole-client/src/messages/forwarded-request-message.ts
  7:14  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any
  8:11  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/robbie/projects/tunnelmole-client/src/messages/forwarded-response-message.ts
  8:14  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/robbie/projects/tunnelmole-client/src/tunnelmole.ts
  101:34  warning  'reject' is defined but never used  @typescript-eslint/no-unused-vars

/home/robbie/projects/tunnelmole-client/src/websocket/host-ip-websocket.ts
  5:26  warning  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

/home/robbie/projects/tunnelmole-client/test/integration/test-server/app.ts
  6:7  warning  'port' is assigned a value but never used  @typescript-eslint/no-unused-vars

/home/robbie/projects/tunnelmole-client/test/integration/tunnelmole.test.ts
  20:37  warning  'reject' is defined but never used                            @typescript-eslint/no-unused-vars
  73:13  error    Do not use "@ts-ignore" because it alters compilation errors  @typescript-eslint/ban-ts-comment

โœ– 22 problems (3 errors, 19 warnings)

I'll get around to these at some point, but PRs are welcome.

Tunnel Going In And Out

Why would I would I purchase a subscription to a permanent URL address, if I can't even rely on the trial url to not constantly reset? The entire reason to self-host is bypassing the issues inhrent to text and other media hosted here.

I basically had to upload my video here with a 25MB limit ( a limit almost all modern YT videos go past ), and then plug it into my self-hosted site.

Hanging via CLI as well as programatically

Hey @robbie-cahill ! Thank you for the library, it has been working well for us over the last several weeks.
However, today, tunnelmole seems to be hanging via the CLI, similar to #1 :

max ~  $ tmole -V
2.2.5
max ~  $ tmole 3030
// hangs, no output

as well as programatically:

const url = await tunnelmole({
    port: 3030
});

I have asked others to try it, and it is the same issue, whether that's on Linux, or Mac (M1/M2). No VPN/firewalls.

Is there a way to get debug logs to help with troubleshooting?

Thanks!

Next.js (webpack) hot module reloading does not work

software versions

$ cat /etc/os-release
PRETTY_NAME="Pop!_OS 22.04 LTS"
$ node --version
v18.15.0
$ yarn tunnelmole -V
2.1.10
$ yarn next --version
Next.js v12.3.4

repro

  1. yarn add tunnelmole
  2. yarn next dev & yarn tunnelmole 3000
    ER/AR: tunnel seems to work, the Next.js app loads in browser
  3. Make some arbitrary templating change (copy, remove a block of content, etc)
    ER: the tunneled app should update without a reload
    AR: tunneled app does not update until page is reloaded
    AR: Browser console error:

    Socket connection to 'wss://qmwe6k-ip-xx-xx-xx-xxx.tunnelmole.com/_next/webpack-hmr' failed: Error during WebSocket handshake: Unexpected response code: 404

Uninstallation

Can you please update the instructions of uninstallation in the readme.

Tunnel TCP connection (so we can expose SSH)

I'd like to know if it's possible to use Tunnelmole to connect to SSH. If not, I'd like to suggest this feature.

If we tunnel our port 22, we get both the http and https tunnelmole links

If we try to connect, such as with:

ssh user@<tunnelmole url>

We get this error:

user@<tunnelmole url>: Permission denied (publickey)

Unable to start a tunnel (2.2.8)

I'm seeing the following error on 2.2.8 when starting a tunnel:

1700274107834Caught an error:
AggregateError:
    at internalConnectMultiple (node:net:1114:18)
    at afterConnectMultiple (node:net:1667:5) {
  code: 'ECONNREFUSED',
  [errors]: [
    Error: connect ECONNREFUSED ::1:8081
        at createConnectionError (node:net:1634:14)
        at afterConnectMultiple (node:net:1664:40) {
      errno: -61,
      code: 'ECONNREFUSED',
      syscall: 'connect',
      address: '::1',
      port: 8081
    },
    Error: connect ECONNREFUSED 127.0.0.1:8081
        at createConnectionError (node:net:1634:14)
        at afterConnectMultiple (node:net:1664:40) {
      errno: -61,
      code: 'ECONNREFUSED',
      syscall: 'connect',
      address: '127.0.0.1',
      port: 8081
    }
  ]
}

The local server is reachable at localhost:<port>.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.