[GH-ISSUE #25] Support for stdout log #22

Open
opened 2026-03-02 23:01:48 +03:00 by kerem · 4 comments
Owner

Originally created by @sunilagrya on GitHub (Sep 23, 2020).
Original GitHub issue: https://github.com/agrinman/tunnelto/issues/25

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.

Originally created by @sunilagrya on GitHub (Sep 23, 2020). Original GitHub issue: https://github.com/agrinman/tunnelto/issues/25 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.
Author
Owner

@agrinman commented on GitHub (Sep 24, 2020):

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

<!-- gh-comment-id:698075491 --> @agrinman commented on GitHub (Sep 24, 2020): So if I understand correctly you want something that will write machine-readable data about the created tunnel to stdout right?
Author
Owner

@sunilagrya commented on GitHub (Sep 24, 2020):

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.

<!-- gh-comment-id:698391685 --> @sunilagrya commented on GitHub (Sep 24, 2020): 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.
Author
Owner

@sunilagrya commented on GitHub (Sep 24, 2020):

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!

<!-- gh-comment-id:698400643 --> @sunilagrya commented on GitHub (Sep 24, 2020): 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!_
Author
Owner

@agrinman commented on GitHub (Sep 26, 2020):

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

<!-- gh-comment-id:699246780 --> @agrinman commented on GitHub (Sep 26, 2020): if you're authenticating with a key it will overwrite that session with your new one
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tunnelto#22
No description provided.