Skip to content

Commit aad3b1e

Browse files
rvolosatovsplatten
authored andcommitted
refactor: move implementation to top-level
Signed-off-by: Roman Volosatovs <[email protected]>
1 parent fc23675 commit aad3b1e

File tree

7 files changed

+30
-32
lines changed

7 files changed

+30
-32
lines changed

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
# Generated by Cargo
2-
Rust/debug/
3-
Rust/target/
1+
/target
File renamed without changes.
File renamed without changes.

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,28 @@ Cryptle is similar to Wordle but one important difference is that it is multi-pa
88

99
The standard way to engage with the game is for players to guess the secret words by playing Cryptle from the client side. However, we will also be allowing an alternative: players may write an application which runs on the host side and attempts to derive or otherwise guess the secret words. The mechanism chosen is up to the implementer, but the application must be available as open source (under an OSI license) in a public repository in GitHub or GitLab. It may be written in any programming language, but should not be intentionally obfuscated. The application may run with root privileges. Documentation should be provided to show how the application is able to “guess” or derive the secret words. The host will be running a modern Linux kernel and applications will be run as ELF binaries. No physical access to the host will be allowed or provided.
1010

11+
# Trying it out
12+
13+
## wasmtime
14+
15+
```console
16+
CARGO_TARGET_WASM32_WASI_RUNNER="wasmtime run --tcplisten 127.0.0.1:8443 --env FD_COUNT=1" cargo +nightly run --target wasm32-wasi
17+
```
18+
19+
Server is running on [`http://127.0.0.1:8443`](http://127.0.0.1:8443).
20+
21+
## enarx
22+
23+
after installing enarx in `$PATH` with `cargo install`
24+
25+
```console
26+
CARGO_TARGET_WASM32_WASI_RUNNER="enarx run --wasmcfgfile ../Enarx.toml" cargo +nightly run --target wasm32-wasi
27+
```
28+
29+
or simply with the help of `.cargo/config`:
30+
31+
```console
32+
cargo +nightly run
33+
```
34+
35+
Server is running on [`https://127.0.0.1:8443`](https://127.0.0.1:8443).

Rust/README.md

Lines changed: 0 additions & 25 deletions
This file was deleted.
File renamed without changes.

Rust/src/main.rs renamed to src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ use rand::Rng;
88
// https://github.com/haraldh
99

1010
fn index_page() -> &'static [u8] {
11-
include_bytes!("../../client/index.html")
11+
include_bytes!("../client/index.html")
1212
}
1313

1414
fn index_js() -> &'static [u8] {
15-
include_bytes!("../../client/index.js")
15+
include_bytes!("../client/index.js")
1616
}
1717

1818
fn style_css() -> &'static [u8] {
19-
include_bytes!("../../client/styles.css")
19+
include_bytes!("../client/styles.css")
2020
}
2121

2222
const NOT_FOUND: &str = r#"
@@ -194,7 +194,7 @@ fn get_server() -> Server {
194194
fn run() -> Result<(), Box<dyn std::error::Error>> {
195195

196196
// Generate random number from word list
197-
const WORDLIST: &str = include_str!("../../client/wordList.txt");
197+
const WORDLIST: &str = include_str!("../client/wordList.txt");
198198

199199
let mut rng = rand::thread_rng();
200200
let mut random_index: usize = rng.gen_range(0..WORDLIST.len()/6);

0 commit comments

Comments
 (0)