tunnelto icon indicating copy to clipboard operation
tunnelto copied to clipboard

Support for stdout log

Open sunilagrya opened this issue 3 years ago • 4 comments

Hi,

Thank you for creating Tunneto.

I am trying to run tunnel-to inside an electron app, which will start the connection between our customer local machine and send tunnel-to link to our server, So we can download data from the local machine.

let spawn = require('child_process');
let path = "path_to_tunnel_to"
ls = spawn(path, ['--version']);
ls.stdout.on('data', (data) => {
        console.log(data);
});

Output: tunnelto 0.1.12

Here in the above code it is returning the version because the process is terminated.

When I try to run

let spawn = require('child_process');
let path = "path_to_tunnel_to"
ls = spawn(path, ['--port', '3000']);
ls.stdout.on('data', (data) => {
        console.log(data);
});

It will not return anything until the process is terminated. I also tried by adding verbose.

Kindly suggest any other way to do this.

In Ngrok there is option log=stdout it will return logs in stdout. So we can process it and get URL

Then I added subdomain to the arguments, Now I know in which subdomain tunnel-to is running. But I cannot get the tunnel-to Local Inspect Dashboard URL for debugging purposes.

sunilagrya avatar Sep 23 '20 12:09 sunilagrya

So if I understand correctly you want something that will write machine-readable data about the created tunnel to stdout right?

agrinman avatar Sep 24 '20 02:09 agrinman

Yes correct 😀, I need a machine-readable data. Sorry for the above.

When I execute tunnelto in Node child process, I am getting the below output

Line 1


                              %%%%
                              %%%%
             ,,,,,,,,,,,,,,
   %%     ,,,%%%%%%%%%%%%%,,,
  #%%     ,,%%%%%,,,,,#%%%%,,
            ,,,,,,#%%,,,,,,,   ((
              .%%%#%%%%#%
                 %%%%#
                  %(%
                 (%%%(
        ((     (%%%#%%%%#
            ,,,,,,,,,,,,,,,          %%%
          ,,%%%%%%,,,#%%%%%,,
 %%       ,,,%%%%%%%%%%%%%,,,
 %%%        ,,,,,,,,,,,,,,,


Line 2

=> Forwarding to localhost:4567

Local Inspect Dashboard: http://localhost:64276

Here in my logs Success! Remote tunnel created on: https://apple.tunnelto.dev is not printing.

If I get the above line I will parse and get the tunnel URL, that's it.

Thank you so much.

sunilagrya avatar Sep 24 '20 14:09 sunilagrya

Hey another quick question

When I run ./tunnelto --port 1080 --subdomain apple

⣷ Success! Remote tunnel created on: https://apple.tunnelto.dev
=> Forwarding to localhost:1080

And if I open a new tab and run the same command with different port

./tunnelto --port 3000 --subdomain apple

⣷ Success! Remote tunnel created on: https://apple.tunnelto.dev
=> Forwarding to localhost:3000

Local Inspect Dashboard: http://localhost:64628

It is returning Success!. Will it be possible to say Hey this subdomain is already taken!

sunilagrya avatar Sep 24 '20 14:09 sunilagrya

if you're authenticating with a key it will overwrite that session with your new one

agrinman avatar Sep 26 '20 00:09 agrinman