TimeToogo / tunshell

Remote shell into ephemeral environments 🐚 🦀
https://tunshell.com
MIT License
767 stars 56 forks source link

[Feature Request] Generate session via command line #14

Closed reedrw closed 3 years ago

reedrw commented 3 years ago

I use this service quite often and think it would be very convenient to be able to generate sessions through a command line tool. Maybe the syntax could be something like: $ tunshell curl and then it would output the command to run on the remote host (or copy it directly to the clipboard if applicable) and start waiting for the peer connection.

For reference, the way I currently use Tunshell is through a GitHub Actions workflow_dispatch trigger with a command input, which is executed by the runner.

Thanks for running this service, it's really helped me out! 😃

TimeToogo commented 3 years ago

This is achievable if you scripted the API calls:

  1. Find the nearest relay server hostname:
    curl https://nearest.relay.tunshell.com/api/info
    # {"domain_name": "au.relay.tunshell.com"}
  2. Generate session keys:
    curl -XPOST https://au.relay.tunshell.com/api/sessions
    # {"peer1_key": "...", "peer2_key": "..."}

If you want a local cli tool to automate this PR's are always welcome :)