b1121dabb9
* Rename to bin-common * Merge into new crate * Merge 3 crates into bin-common * WIP * Move build.rs to the correct place * regex nym_bin_common * regex nym_bin_common::build_information * regex nym_version_checker * Update some explicit mod paths * Makefile: add nym-connect-android * Additional fixes * rustfmt * Update crate metadata * Move completions crate into nym-bin-common * Makefile: add examples * Fix examples * rustfmt
22 lines
709 B
Rust
22 lines
709 B
Rust
use nym_sdk::mixnet;
|
|
|
|
#[tokio::main]
|
|
async fn main() {
|
|
nym_bin_common::logging::setup_logging();
|
|
|
|
// Passing no config makes the client fire up an ephemeral session and figure shit out on its own
|
|
let mut client = mixnet::MixnetClient::connect_new().await.unwrap();
|
|
|
|
// Be able to get our client address
|
|
let our_address = client.nym_address();
|
|
println!("Our client nym address is: {our_address}");
|
|
|
|
// Send a message throught the mixnet to ourselves
|
|
client.send_str(*our_address, "hello there").await;
|
|
|
|
println!("Waiting for message (ctrl-c to exit)");
|
|
client
|
|
.on_messages(|msg| println!("Received: {}", String::from_utf8_lossy(&msg.message)))
|
|
.await;
|
|
}
|