elisescu / tty-share

Share your linux or osx terminal over the Internet.
https://tty-share.com/
MIT License
816 stars 87 forks source link

Make local `-listen` binding opt-in, or allow `-listen` to use first available port in a range. #28

Open strazto opened 3 years ago

strazto commented 3 years ago

tl;dr

It's annoying that running a new session of tty-share fails if localhost:8000 is unavable, eg another tty-share session is using it. (especially when you only care about the public session)

It would be nice if the default was to bind to the first available port in a range, eg localhost:8000-8010. If 8000 is taken, then the session binds to localhost:8001 etc.

Details

It's great that tty-share's flexibility has been enhanced, but I find that a few new features detract from its vision as the "easy" non-astonishing method of sharing your terminal.

One such feature is the local session feature. I find that this feature typically makes launching parallel sessions annoying, or launching sessions when localhost:8000 has been bound, for example, if I'm running a local dev server.

The solution is fairly simple, of course, just give it the listen arg- tty-share -listen localhost:8001, but this step is still a step away from tty-share being the "easy mode" of session sharing.

This could be resolved by either:

To me, specifying a port range feels like the better option

A few caveats:

elisescu commented 3 years ago

Fair point, @matthewstrasiotto. At first sight, I tend to agree with your suggested approach, of using the next available port in a range (with a reasonable default range), but I would like to think a bit more about it. And hopefully will get some time to look into it soon

0x326 commented 3 years ago

I think a boolean flag -local would be appropriate (e.g. -local=true, -local=false, true by default). I would prefer this over a port-range-only option, but I think a boolean flag and a port range would be appropriate too