419e16eb31
* Remove pretty_env_logger dependency * Switch remaining instances of pretty_env_logger to tracing
27 lines
879 B
Rust
27 lines
879 B
Rust
use nym_sdk::mixnet;
|
|
use nym_sdk::mixnet::MixnetMessageSender;
|
|
|
|
#[tokio::main]
|
|
async fn main() {
|
|
nym_bin_common::logging::setup_tracing_logger();
|
|
|
|
// 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();
|
|
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 through the mixnet to ourselves
|
|
client
|
|
.send_plain_message(*our_address, "hello there")
|
|
.await
|
|
.unwrap();
|
|
|
|
println!("Waiting for message (ctrl-c to exit)");
|
|
client
|
|
.on_messages(|msg| println!("Received: {}", String::from_utf8_lossy(&msg.message)))
|
|
.await;
|
|
}
|