https://github.com/yerkopalma/dsh
:globe_with_meridians: Remotelly run commands using Dat
https://github.com/yerkopalma/dsh
dat-protocol
Last synced: 2 months ago
JSON representation
:globe_with_meridians: Remotelly run commands using Dat
- Host: GitHub
- URL: https://github.com/yerkopalma/dsh
- Owner: YerkoPalma
- Created: 2018-09-12T20:09:13.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-09-14T16:43:10.000Z (almost 7 years ago)
- Last Synced: 2025-03-25T08:42:46.227Z (3 months ago)
- Topics: dat-protocol
- Language: JavaScript
- Homepage:
- Size: 27.3 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `dsh`
Remotelly run commands using Dat.
## 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 ` 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 `dshell`file 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
```bash
$ dsh
dsh > helpCommands:
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.
``````bash
$ dsh
dsh > start
Dat link is: dat://2f1e21edde3fae6d62b5b124e03ded374d2717d3398bb20de57700f4348946d6
Enter remote Dat key?
```
## The daemon process
```bash
$ dshd
Dat link is: dat://2f1e21edde3fae6d62b5b124e03ded374d2717d3398bb20de57700f4348946d6
```