Gun-rs

Pure Rust implementation of Gun. For a wasm version, check out gun-rs-wasm.

Deployed at https://gun-us.herokuapp.com (serves iris-messenger at the root)

Live stats: https://gun-us.herokuapp.com/stats

Use

Install Rust first.

Gun server

cargo install gundb gundb start

Gun library

rust 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 sub = db.get("greeting").on(); db.get("greeting").put("Hello World!".into()); if let Ok(value) = sub.recv().await { if let GunValue::Text(str) = value { assert_eq!(&str, "Hello World!"); } }

Status

3/12/2021:

Develop

cargo install cargo-watch RUST_LOG=debug cargo watch -x 'run -- start'

Run on Heroku

heroku create --buildpack emk/rust git push heroku master

or:

Deploy