GithubHelp home page GithubHelp logo

dsh's Introduction

dsh

Remotelly run commands using Dat.

demo-dsh

How it works

Creates a folder (.datsrc) with the following content

.dsrc/
├── .dat/
├── .dshell
├── .key
└── .datignore

The dat folder is created by Dat, so there's nothing to explain here. The .dshell file is the main file. This is the only file shared through dat to the remote peer. It contains the commands to be executed remotely.

The logic is simple: Once connected to the shell, running run <command> will write to the local .dshell file the command, and replicate it through dat to the remote machine. Previously, in the remote machine there should have started the listener process dshd, this process get the public key of the original process as a parameter, and return a second key. This is because we are using two dats for bidirectional communication. This should change with multiwriter support. The second key is copied in the original machine.

This whole connection process whould happen only once in the original machine, and everytime the process start in the remote machine (althought is supposed to start once only).

So, when the remote machine gets an update in the dshellfile replicated from the original one, it will read its content and executed as a child process, the will write stdout and stderr to .stdout and .stderr to the second Dat thats used to replicate output to the originall machine. Finally, the original machine will listen to the output update and print it to the console.

The client (original) process

$ dsh
dsh > help

  Commands:

    start              Start the Dat connections
    exit               Exits application.
    run [commands...]  Run commands when connected to a Dat
    close              Close connection to Dat
    help [command...]  Provides help for a given command.
$ dsh
dsh > start
Dat link is: dat://2f1e21edde3fae6d62b5b124e03ded374d2717d3398bb20de57700f4348946d6
Enter remote Dat key?

The daemon process

$ dshd <key>
Dat link is: dat://2f1e21edde3fae6d62b5b124e03ded374d2717d3398bb20de57700f4348946d6

dsh's People

Contributors

yerkopalma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dsh's Issues

Todo

  • Rename variables, folders and files
  • Add missing files
  • Dynamically create folders when possible
  • Save and reuse keys
  • Improve docs (add images and gifs)
  • Publish

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.