Pure Rust implementation of Gun.js. For a wasm version, check out gun-rs-wasm.
Deployed at https://gun-rs.iris.to (serves iris-messenger at the root)
Live stats: https://gun-rs.iris.to/stats
- Rust can be compiled into high-performing native binaries on many platforms, including embedded systems.
- Maintaining and contributing to the codebase is easier than in Gun.js. Gun.js doesn't have compilation or minification steps, and the code is kind of manually minified 😄
Install Rust first.
cargo install gundb
gundb start
use gundb::{Node, NodeConfig};
use gundb::types::GunValue;
let mut db = Node::new_with_config(NodeConfig {
outgoing_websocket_peers: vec!["wss://some-server-to-sync.with/gun".to_string()],
..NodeConfig::default()
});
let mut sub = db.get("greeting").on();
db.get("greeting").put("Hello World!".into());
if let GunValue::Text(str) = sub.recv().await.unwrap() {
assert_eq!(&str, "Hello World!");
}
3/12/2021:
- Gun basic API
- CLI for running the server
- Incoming websockets
- Outgoing websockets (env PEERS=wss://some-server-url.herokuapp.com/gun)
- Multicast (Iris messages seem not to propagate — size limit?)
- In-memory storage
- TLS support (env CERT_PATH and KEY_PATH)
- Advanced deduplication of sync messages
- Publish & subscribe
- Disk storage
- SEA (verification of signed data)
- When multiple adapters are enabled, it sometimes gets stuck
- User-space nodes (js:
gun.user().get('something')
) are relayed, but not properly retrieved and sent from memory (wrong format somehow) - Multicast doesn't relay large messages like Iris posts
cargo install cargo-watch
RUST_LOG=debug cargo watch -x 'run -- start'
heroku create --buildpack emk/rust
git push heroku master
or: