Compare commits

...

10 Commits

Author SHA1 Message Date
Akilan Selvacoumar
c8e6ac9858 Create README.md 2025-07-04 20:33:12 +01:00
0e8d2ef45e saving current changes 2025-06-28 12:41:53 +01:00
0cdfab9d5d added wrtie config bindings 2025-06-28 11:57:34 +01:00
e2ca1982f5 added support for map port, list server and run server command 2025-06-27 15:00:34 +01:00
f41119634a added base p2prc instruction~ 2025-06-26 18:17:07 +01:00
7eedcec536 added base process code 2025-06-26 17:13:26 +01:00
58c80760de removed binary 2025-06-24 18:18:43 +01:00
ba383ec9bc added build for Miso 2025-06-24 18:18:03 +01:00
4164a0c759 Added possibility to add binaries 2025-06-24 18:06:40 +01:00
83861987cf push 3 sub projects 2025-06-24 17:31:43 +01:00
14 changed files with 1517 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
bin/
*.out

1
README.md Normal file
View File

@@ -0,0 +1 @@
./input-leapc -f --disable-crypto --debug DEBUG 217.76.63.222:34225 (Sample barrier command)

14
build.sh Normal file
View File

@@ -0,0 +1,14 @@
# Make binary directory
mkdir bin
# Build Laplace and move to bin directory
cd Laplace
go build -o laplace.out
cp laplace.out ../bin
cp -r files ../bin
cd ..
# Install webserver
cd server
cabal update
cabal install --installdir=../bin --overwrite-policy=always

104
process/.gitignore vendored Normal file
View File

@@ -0,0 +1,104 @@
# This file should only ignore things that are generated during a `x.py` build,
# generated by common IDEs, and optional files controlled by the user that
# affect the build (such as bootstrap.toml).
# In particular, things like `mir_dump` should not be listed here; they are only
# created during manual debugging and many people like to clean up instead of
# having git ignore such leftovers. You can use `.git/info/exclude` to
# configure your local ignore list.
## File system
.DS_Store
desktop.ini
## Editor
*.swp
*.swo
Session.vim
.cproject
.idea
*.iml
.vscode
.project
.vim/
.helix/
.zed/
.favorites.json
.settings/
.vs/
.dir-locals.el
## Tool
.valgrindrc
.cargo
# Included because it is part of the test case
!/tests/run-make/thumb-none-qemu/example/.cargo
## Configuration
/bootstrap.toml
/config.toml
/Makefile
config.mk
config.stamp
no_llvm_build
## Build
/dl/
/doc/
/inst/
/llvm/
/mingw-build/
/build
/build-rust-analyzer/
/dist/
/unicode-downloads
/target
/library/target
/src/bootstrap/target
/src/ci/citool/target
/src/tools/x/target
# Created by `x vendor`
/vendor
# Created by default with `src/ci/docker/run.sh`
/obj/
# Created by nix dev shell / .envrc
src/tools/nix-dev-shell/flake.lock
## ICE reports
rustc-ice-*.txt
## Temporary files
*~
\#*
\#*\#
.#*
## Tags
tags
tags.*
TAGS
TAGS.*
## Python
__pycache__/
*.py[cod]
*$py.class
## Node
node_modules
package-lock.json
package.json
/src/doc/rustc-dev-guide/mermaid.min.js
## Rustdoc GUI tests
tests/rustdoc-gui/src/**.lock
## direnv
/.envrc
/.direnv/
## nix
/flake.nix
flake.lock
/default.nix
# Before adding new lines, see the comment at the top.

853
process/Cargo.lock generated Normal file
View File

@@ -0,0 +1,853 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "addr2line"
version = "0.24.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1"
dependencies = [
"gimli",
]
[[package]]
name = "adler2"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
[[package]]
name = "async-channel"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35"
dependencies = [
"concurrent-queue",
"event-listener 2.5.3",
"futures-core",
]
[[package]]
name = "async-channel"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a"
dependencies = [
"concurrent-queue",
"event-listener-strategy",
"futures-core",
"pin-project-lite",
]
[[package]]
name = "async-executor"
version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb812ffb58524bdd10860d7d974e2f01cc0950c2438a74ee5ec2e2280c6c4ffa"
dependencies = [
"async-task",
"concurrent-queue",
"fastrand",
"futures-lite",
"pin-project-lite",
"slab",
]
[[package]]
name = "async-global-executor"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c"
dependencies = [
"async-channel 2.3.1",
"async-executor",
"async-io",
"async-lock",
"blocking",
"futures-lite",
"once_cell",
]
[[package]]
name = "async-io"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1237c0ae75a0f3765f58910ff9cdd0a12eeb39ab2f4c7de23262f337f0aacbb3"
dependencies = [
"async-lock",
"cfg-if",
"concurrent-queue",
"futures-io",
"futures-lite",
"parking",
"polling",
"rustix",
"slab",
"tracing",
"windows-sys 0.59.0",
]
[[package]]
name = "async-lock"
version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18"
dependencies = [
"event-listener 5.4.0",
"event-listener-strategy",
"pin-project-lite",
]
[[package]]
name = "async-std"
version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "730294c1c08c2e0f85759590518f6333f0d5a0a766a27d519c1b244c3dfd8a24"
dependencies = [
"async-channel 1.9.0",
"async-global-executor",
"async-io",
"async-lock",
"crossbeam-utils",
"futures-channel",
"futures-core",
"futures-io",
"futures-lite",
"gloo-timers",
"kv-log-macro",
"log",
"memchr",
"once_cell",
"pin-project-lite",
"pin-utils",
"slab",
"wasm-bindgen-futures",
]
[[package]]
name = "async-task"
version = "4.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de"
[[package]]
name = "atomic-waker"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "backtrace"
version = "0.3.75"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002"
dependencies = [
"addr2line",
"cfg-if",
"libc",
"miniz_oxide",
"object",
"rustc-demangle",
"windows-targets 0.52.6",
]
[[package]]
name = "bitflags"
version = "2.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
[[package]]
name = "blocking"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea"
dependencies = [
"async-channel 2.3.1",
"async-task",
"futures-io",
"futures-lite",
"piper",
]
[[package]]
name = "bumpalo"
version = "3.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
[[package]]
name = "cfg-if"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268"
[[package]]
name = "concurrent-queue"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
[[package]]
name = "errno"
version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad"
dependencies = [
"libc",
"windows-sys 0.60.2",
]
[[package]]
name = "event-listener"
version = "2.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
[[package]]
name = "event-listener"
version = "5.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3492acde4c3fc54c845eaab3eed8bd00c7a7d881f78bfc801e43a93dec1331ae"
dependencies = [
"concurrent-queue",
"parking",
"pin-project-lite",
]
[[package]]
name = "event-listener-strategy"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93"
dependencies = [
"event-listener 5.4.0",
"pin-project-lite",
]
[[package]]
name = "fastrand"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
[[package]]
name = "futures-channel"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
dependencies = [
"futures-core",
]
[[package]]
name = "futures-core"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
[[package]]
name = "futures-io"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
[[package]]
name = "futures-lite"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5edaec856126859abb19ed65f39e90fea3a9574b9707f13539acf4abf7eb532"
dependencies = [
"fastrand",
"futures-core",
"futures-io",
"parking",
"pin-project-lite",
]
[[package]]
name = "getrandom"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
dependencies = [
"cfg-if",
"libc",
"r-efi",
"wasi",
]
[[package]]
name = "gimli"
version = "0.31.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f"
[[package]]
name = "gloo-timers"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbb143cf96099802033e0d4f4963b19fd2e0b728bcf076cd9cf7f6634f092994"
dependencies = [
"futures-channel",
"futures-core",
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "hermit-abi"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"
[[package]]
name = "itoa"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
[[package]]
name = "js-sys"
version = "0.3.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f"
dependencies = [
"once_cell",
"wasm-bindgen",
]
[[package]]
name = "kv-log-macro"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f"
dependencies = [
"log",
]
[[package]]
name = "libc"
version = "0.2.174"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
[[package]]
name = "linux-raw-sys"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12"
[[package]]
name = "log"
version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
dependencies = [
"value-bag",
]
[[package]]
name = "memchr"
version = "2.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"
[[package]]
name = "miniz_oxide"
version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
dependencies = [
"adler2",
]
[[package]]
name = "object"
version = "0.36.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87"
dependencies = [
"memchr",
]
[[package]]
name = "once_cell"
version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
name = "parking"
version = "2.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba"
[[package]]
name = "pin-project-lite"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
[[package]]
name = "pin-utils"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "piper"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066"
dependencies = [
"atomic-waker",
"fastrand",
"futures-io",
]
[[package]]
name = "polling"
version = "3.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b53a684391ad002dd6a596ceb6c74fd004fdce75f4be2e3f615068abbea5fd50"
dependencies = [
"cfg-if",
"concurrent-queue",
"hermit-abi",
"pin-project-lite",
"rustix",
"tracing",
"windows-sys 0.59.0",
]
[[package]]
name = "proc-macro2"
version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
dependencies = [
"proc-macro2",
]
[[package]]
name = "r-efi"
version = "5.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
[[package]]
name = "rustc-demangle"
version = "0.1.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f"
[[package]]
name = "rustix"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266"
dependencies = [
"bitflags",
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.59.0",
]
[[package]]
name = "rustversion"
version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d"
[[package]]
name = "ryu"
version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
[[package]]
name = "serde"
version = "1.0.219"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.219"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "serde_json"
version = "1.0.140"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373"
dependencies = [
"itoa",
"memchr",
"ryu",
"serde",
]
[[package]]
name = "slab"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04dc19736151f35336d325007ac991178d504a119863a2fcb3758cdb5e52c50d"
[[package]]
name = "spin_process"
version = "0.1.0"
dependencies = [
"async-std",
"serde",
"serde_json",
"tokio",
"uuid",
]
[[package]]
name = "syn"
version = "2.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "tokio"
version = "1.45.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779"
dependencies = [
"backtrace",
"pin-project-lite",
"tokio-macros",
]
[[package]]
name = "tokio-macros"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "tracing"
version = "0.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
dependencies = [
"pin-project-lite",
"tracing-core",
]
[[package]]
name = "tracing-core"
version = "0.1.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678"
[[package]]
name = "unicode-ident"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
[[package]]
name = "uuid"
version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d"
dependencies = [
"getrandom",
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "value-bag"
version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "943ce29a8a743eb10d6082545d861b24f9d1b160b7d741e0f2cdf726bec909c5"
[[package]]
name = "wasi"
version = "0.14.2+wasi-0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3"
dependencies = [
"wit-bindgen-rt",
]
[[package]]
name = "wasm-bindgen"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
dependencies = [
"cfg-if",
"once_cell",
"rustversion",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6"
dependencies = [
"bumpalo",
"log",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61"
dependencies = [
"cfg-if",
"js-sys",
"once_cell",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
dependencies = [
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d"
dependencies = [
"unicode-ident",
]
[[package]]
name = "web-sys"
version = "0.3.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "windows-sys"
version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "windows-sys"
version = "0.60.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
dependencies = [
"windows-targets 0.53.2",
]
[[package]]
name = "windows-targets"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
"windows_aarch64_gnullvm 0.52.6",
"windows_aarch64_msvc 0.52.6",
"windows_i686_gnu 0.52.6",
"windows_i686_gnullvm 0.52.6",
"windows_i686_msvc 0.52.6",
"windows_x86_64_gnu 0.52.6",
"windows_x86_64_gnullvm 0.52.6",
"windows_x86_64_msvc 0.52.6",
]
[[package]]
name = "windows-targets"
version = "0.53.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef"
dependencies = [
"windows_aarch64_gnullvm 0.53.0",
"windows_aarch64_msvc 0.53.0",
"windows_i686_gnu 0.53.0",
"windows_i686_gnullvm 0.53.0",
"windows_i686_msvc 0.53.0",
"windows_x86_64_gnu 0.53.0",
"windows_x86_64_gnullvm 0.53.0",
"windows_x86_64_msvc 0.53.0",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
name = "windows_aarch64_msvc"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnu"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_gnullvm"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
name = "windows_i686_msvc"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
name = "windows_x86_64_gnu"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "windows_x86_64_msvc"
version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
[[package]]
name = "wit-bindgen-rt"
version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
dependencies = [
"bitflags",
]

18
process/Cargo.toml Normal file
View File

@@ -0,0 +1,18 @@
[package]
name = "spin_process"
version = "0.1.0"
edition = "2021"
authors = ["Your Name <you@example.com>"]
description = "Simulates a process launcher similar to a Bash script"
license = "MIT"
[dependencies]
uuid = { version = "1", features = ["v4"] }
tokio = { version = "1.45.1", features = ["rt", "rt-multi-thread", "macros", "time"] }
serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.140"
async-std = "1.13.1"
[[bin]]
name = "spin_process"
path = "src/SpinProcess.rs"

66
process/p2prc-process.sh Normal file
View File

@@ -0,0 +1,66 @@
#!/bin/bash
# Simulate NodeInfo as separate variables
NodeInfo_IPV4="192.168.1.20"
NodeInfo_ServerPort="9000"
# UUID fallback
generate_uuid() {
echo "uuid-$(date +%s%N)"
}
P2PRCMapPort() {
local port="$1"
local domain="$2"
local server="$3"
echo "${domain}:${port}"
}
AddProcessToMemory() {
local id="$1"
echo "Added to memory: $id"
}
SaveProcess() {
echo "Saved to disk (simulated)"
}
SpinProcess() {
# Parameters are passed as positional args
local InternalPortNo="$1"
local CommandToRunScript="$2"
local DomainName="$3"
# Run script (locally)
bash "$CommandToRunScript"
# Server address
local ServerAddress="${NodeInfo_IPV4}:${NodeInfo_ServerPort}"
# Map port
local ExternalAddress
ExternalAddress=$(P2PRCMapPort "$InternalPortNo" "$DomainName" "$ServerAddress")
# Generate UUID and set status
local ID
ID=$(generate_uuid)
local Status="true"
# Output simulated "process object"
echo "Process Started:"
echo "ID: $ID"
echo "InternalPortNo: $InternalPortNo"
echo "ExternalAddress: $ExternalAddress"
echo "DomainName: $DomainName"
echo "Status: $Status"
AddProcessToMemory "$ID"
SaveProcess
}
# Example usage
InternalPortNo="8080"
CommandToRunScript="test.sh"
DomainName="example.com"
SpinProcess "$InternalPortNo" "$CommandToRunScript" "$DomainName"

140
process/src/SpinProcess.rs Normal file
View File

@@ -0,0 +1,140 @@
mod p2prc;
use std::fmt::Debug;
use std::process::Command;
use std::fs::{self, File};
use std::io::{self, Write};
use uuid::Uuid;
use crate::p2prc::*;
use tokio::time::{sleep, Duration};
// Struct representing NodeInfo
#[derive(Debug)]
struct NodeInfo {
ipv4: String,
server_port: String,
}
// Struct representing Process
#[derive(Debug)]
struct Process {
id: String,
internal_port_no: String,
external_address: String,
node_id: String,
task_name: String,
command_to_run_script: String,
command_to_kill_script: String,
status: bool,
domain_name: String,
}
// Simulate mapping a port to a public address
fn p2prc_map_port(port: &str, domain: &str, server_address: &str) -> String {
format!("{}:{}", domain, port) // Simulate mapping
}
// Simulate saving a process to memory (e.g., to a file or in-memory list)
fn add_process_to_memory(process: &Process) {
println!("Process added to memory: {:?}", process);
}
// Simulate saving the process to disk (e.g., JSON file)
fn save_process(process: &Process) -> io::Result<()> {
let mut file = File::create("process_saved.txt")?;
writeln!(file, "{:?}", process)?;
Ok(())
}
// The SpinProcess function
fn spin_process(mut process: Process) -> Process {
// 1. Run the script
let _ = Command::new("bash")
.arg(&process.command_to_run_script)
.status()
.expect("Failed to start script");
// 2. Generate server address
let server_address = format!("{}:{}", "0.0.0.0", "1245");
// 3. Map to external address
process.external_address = p2prc_map_port(&process.internal_port_no, &process.domain_name, &server_address);
// 4. Generate UUID
process.id = Uuid::new_v4().to_string();
// 5. Set status
process.status = true;
// 6. Save process to memory and disk
add_process_to_memory(&process);
// save_process(&process).expect("Failed to save process");
process
}
// Main function
#[tokio::main]
async fn main() {
// Start p2prc in the background
tokio::spawn(async {
p2prc_start_server().await;
});
// list servers on the network
println!("{:#?}", p2prc_list_server_command());
// Before next instruction sleep for 2 seconds
sleep(Duration::from_secs(4)).await;
// Test map port output
println!("{:#?}", p2prc_map_port_command("3000","test.akilan.io",""));
let mut config = p2prc_read_config();
// Change server port
config.server_port = "1233".parse().unwrap();
p2prc_write_config(config);
println!("{:#?}", p2prc_read_config());
// p2prc_default_config();
// println!("{:#?}", p2prc_read_config());
println!("{:#?}", p2prc_get_specs("217.76.63.222:32921".to_string()));
// println!("{}", p2prc_map_port_command("3000", "0.0.0.0",""));
// println!("Starting SpinProcess...");
//
// let node_info = NodeInfo {
// ipv4: "192.168.1.20".to_string(),
// server_port: "9000".to_string(),
// };
//
// let process = Process {
// id: String::new(),
// internal_port_no: "".to_string(),
// external_address: "".to_string(),
// node_id: "Test".to_string(),
// task_name: "ExampleTask".to_string(),
// command_to_run_script: "./run_script.sh".to_string(),
// command_to_kill_script: "./kill_script.sh".to_string(),
// status: false,
// domain_name: "example.com".to_string(),
// };
//
// let updated = spin_process(process);
//
// println!("Final Process: {:?}", updated);
// Start P2PRC as a server to test if the background process works
}

191
process/src/p2prc.rs Normal file
View File

@@ -0,0 +1,191 @@
use std::fs;
use std::io::Error;
use std::net::IpAddr;
use std::process::{Command, Output};
use serde::{Deserialize, Serialize};
use serde::de::DeserializeOwned;
#[derive(Debug, Serialize, Deserialize)]
pub struct IPAddressList {
pub ip_address: Vec<IPAddressEntry>,
}
// Maps p2prc --ls output to the following
// data structure
#[derive(Debug, Serialize, Deserialize)]
pub struct IPAddressEntry {
pub Name: String,
pub MachineUsername: String,
pub IPV4: String,
pub IPV6: String,
pub Latency: u64,
pub Download: u64,
pub Upload: u64,
pub ServerPort: String,
pub BareMetalSSHPort: String,
pub NAT: bool,
pub EscapeImplementation: String,
pub ProxyServer: bool,
pub UnSafeMode: bool,
pub PublicKey: String,
pub CustomInformation: String,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct Config {
#[serde(rename = "MachineName")]
pub machine_name: String,
#[serde(rename = "IPTable")]
pub iptable: String,
#[serde(rename = "DockerContainers")]
pub docker_containers: String,
#[serde(rename = "DefaultDockerFile")]
pub default_docker_file: String,
#[serde(rename = "DockerRunLogs")]
pub docker_run_logs: String,
#[serde(rename = "SpeedTestFile")]
pub speed_test_file: String,
#[serde(rename = "IPV6Address")]
pub ipv6address: String,
#[serde(rename = "PluginPath")]
pub plugin_path: String,
#[serde(rename = "TrackContainersPath")]
pub track_containers_path: String,
#[serde(rename = "ServerPort")]
pub server_port: String,
#[serde(rename = "ProxyPort")]
pub proxy_port: String,
#[serde(rename = "GroupTrackContainersPath")]
pub group_track_containers_path: String,
#[serde(rename = "FRPServerPort")]
pub frpserver_port: bool,
#[serde(rename = "BehindNAT")]
pub behind_nat: bool,
#[serde(rename = "IPTableKey")]
pub iptable_key: String,
#[serde(rename = "PublicKeyFile")]
pub public_key_file: String,
#[serde(rename = "PrivateKeyFile")]
pub private_key_file: String,
#[serde(rename = "PemFile")]
pub pem_file: String,
#[serde(rename = "KeyFile")]
pub key_file: String,
#[serde(rename = "BareMetal")]
pub bare_metal: bool,
#[serde(rename = "UnsafeMode")]
pub unsafe_mode: bool,
#[serde(rename = "Test")]
pub test: bool,
#[serde(rename = "ConfigPath")]
pub config_path: String
}
#[derive(Serialize, Deserialize, Debug)]
pub struct MapPort {
#[serde(rename = "IPAddress")]
pub ipaddress: String,
#[serde(rename = "PortNo")]
pub port_no: String,
#[serde(rename = "EntireAddress")]
pub entire_address: String,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct Specs {
#[serde(rename = "Hostname")]
pub hostname: String,
#[serde(rename = "Platform")]
pub platform: String,
#[serde(rename = "CPU")]
pub cpu: String,
#[serde(rename = "RAM")]
pub ram: i64,
#[serde(rename = "Disk")]
pub disk: i64,
}
// Runs p2prc with custom arguments called.
// Function implemented as an identity function
pub fn run_p2prc_command<T>(arguments: &str) -> T
where
T: DeserializeOwned,
{
let command_str = format!("p2prc {}", arguments);
let output = Command::new("sh")
.arg("-c")
.arg(&command_str)
.output()
.expect("Failed to execute command");
let stdout = String::from_utf8_lossy(&output.stdout);
serde_json::from_str(&stdout).expect("Failed to deserialize JSON output")
}
// Runs p2prc map port command
pub fn p2prc_map_port_command(local_port_no: &str, domain_name: &str,remote_server: &str) -> MapPort{
// Needs a reviews for a better representation
let mut command = vec!["".to_string()];
match !local_port_no.is_empty() {
true => command.push(format!("--mp {}", local_port_no)),
false => (),
}
match !domain_name.is_empty() {
true => command.push(format!("--dn {}", domain_name)),
false => (),
}
match !remote_server.is_empty() {
true => command.push(format!("--ra {}", remote_server)),
false => (),
}
let command = command.join(" ");
println!("{:#?}", command);
let map_port: MapPort = run_p2prc_command(&*command);
map_port
}
// Runs p2prc list server command
pub fn p2prc_list_server_command() -> IPAddressList {
let servers: IPAddressList = run_p2prc_command(&*"--ls".to_string());
servers
}
// Starts p2prc server in the background
pub async fn p2prc_start_server() {
let run_server: Option<bool> = run_p2prc_command(&*"-s".to_string());
}
// Read P2PRC config file
pub fn p2prc_read_config() -> Config {
let config: Config = run_p2prc_command(&*"--vc".to_string());
config
}
// Writes changes to the config file
// write to the config path provided in the config type
// unoptimised but reduces code complexity
pub fn p2prc_write_config(config: Config) {
// Convert config type to a string
let json:String = serde_json::to_string(&config).unwrap().to_string();
fs::write(config.config_path, json).expect("Panic message: ");
}
// Set default config (--dc command)
pub fn p2prc_default_config() {
let _: Option<bool> = run_p2prc_command(&*"--dc".to_string());
}
// Get hardware information of a remote server
pub fn p2prc_get_specs(ip_addr: String) -> Specs {
let command: String = format!("--specs {}", ip_addr);
let specs: Specs = run_p2prc_command(&*command);
specs
}

1
process/test.sh Normal file
View File

@@ -0,0 +1 @@
echo "hello start"

34
server/.gitignore vendored Normal file
View File

@@ -0,0 +1,34 @@
# haskell
.stack-work/
dist-newstyle/
cabal.project.local
.ghc.environment.*
dist
*.o
*.hi
*.jsexe
# nix
result*
# emacs
*~
# darwin
.DS_Store
# misc
TAGS
tags
.direnv
# js
package-lock.json
node_modules/
coverage/
# typescript
*.js
# haddocks
haddocks/

62
server/Main.hs Normal file
View File

@@ -0,0 +1,62 @@
----------------------------------------------------------------------------
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE CPP #-}
----------------------------------------------------------------------------
module Main where
----------------------------------------------------------------------------
import Miso
import Miso.String
import Miso.Lens
----------------------------------------------------------------------------
-- | Component model state
newtype Model = Model
{ _counter :: Int
} deriving (Show, Eq)
----------------------------------------------------------------------------
counter :: Lens Model Int
counter = lens _counter $ \record field -> record { _counter = field }
----------------------------------------------------------------------------
-- | Sum type for Component events
data Action
= AddOne
| SubtractOne
| SayHelloWorld
deriving (Show, Eq)
----------------------------------------------------------------------------
-- | Entry point for a miso application
main :: IO ()
main = run (startComponent component)
----------------------------------------------------------------------------
-- | WASM export, required when compiling w/ the WASM backend.
#ifdef WASM
foreign export javascript "hs_start" main :: IO ()
#endif
----------------------------------------------------------------------------
-- | `defaultComponent` takes as arguments the initial model, update function, view function
component :: Component name Model Action
component = defaultComponent emptyModel updateModel viewModel
----------------------------------------------------------------------------
-- | Empty application state
emptyModel :: Model
emptyModel = Model 0
----------------------------------------------------------------------------
-- | Updates model, optionally introduces side effects
updateModel :: Action -> Effect Model Action
updateModel = \case
AddOne -> counter += 1
SubtractOne -> counter -= 1
SayHelloWorld -> io_ $ do
consoleLog "Hello World"
alert "Hello World"
----------------------------------------------------------------------------
-- | Constructs a virtual DOM from a model
viewModel :: Model -> View Action
viewModel x = div_ []
[ button_ [ onClick AddOne ] [ text "+" ]
, text $ ms (x ^. counter)
, button_ [ onClick SubtractOne ] [ text "-" ]
, button_ [ onClick SayHelloWorld ] [ text "Alert Hello World!" ]
]
----------------------------------------------------------------------------

24
server/app.cabal Normal file
View File

@@ -0,0 +1,24 @@
cabal-version: 2.2
name: app
version: 0.1.0.0
synopsis: Sample miso app
category: Web
common wasm
if arch(wasm32)
ghc-options:
-no-hs-main
-optl-mexec-model=reactor
"-optl-Wl,--export=hs_start"
cpp-options:
-DWASM
executable app
import:
wasm
main-is:
Main.hs
build-depends:
base, miso
default-language:
Haskell2010

7
server/cabal.project Normal file
View File

@@ -0,0 +1,7 @@
packages:
.
source-repository-package
type: git
location: https://github.com/dmjio/miso
branch: master