Skip to content

Commit

Permalink
examples(pkarr): enable using relay client
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuhvi committed Oct 18, 2024
1 parent e835d13 commit 134beae
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
13 changes: 13 additions & 0 deletions pkarr/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,21 @@
cargo run --example publish
```

or to use a Relay client:

```sh
cargo run --features relay --example publish
```

## Resolve

```sh
cargo run --example resolve <zbase32 public key from Publish step>
```

or to use a Relay client:

```sh
cargo run --features relay --example resolve <zbase32 public key from Publish step>
```

8 changes: 7 additions & 1 deletion pkarr/examples/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@ use tracing_subscriber;

use std::time::Instant;

use pkarr::{dns, Client, Keypair, SignedPacket};
use pkarr::{dns, Keypair, SignedPacket};

#[cfg(feature = "relay")]
use pkarr::client::relay::Client;
#[cfg(not(feature = "relay"))]
use pkarr::Client;

#[tokio::main]
async fn main() {
tracing_subscriber::fmt()
.with_max_level(Level::DEBUG)
.with_env_filter("pkarr")
.init();

let client = Client::builder().build().unwrap();
Expand Down
9 changes: 7 additions & 2 deletions pkarr/examples/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ use std::{
time::{Duration, Instant},
};

use pkarr::{Client, PublicKey};

use clap::Parser;

use pkarr::PublicKey;

#[cfg(feature = "relay")]
use pkarr::client::relay::Client;
#[cfg(not(feature = "relay"))]
use pkarr::Client;

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
struct Cli {
Expand Down

0 comments on commit 134beae

Please sign in to comment.