Skip to content

Commit

Permalink
chore: Update example
Browse files Browse the repository at this point in the history
  • Loading branch information
dariusc93 committed Sep 19, 2023
1 parent b0e7454 commit 2173f08
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions extensions/warp-ipfs/examples/messenger.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use clap::Parser;
use comfy_table::Table;
use futures::prelude::*;
use rust_ipfs::Multiaddr;
use rustyline_async::{Readline, ReadlineError, SharedWriter};
use std::collections::HashMap;
use std::io::Write;
Expand All @@ -23,7 +24,7 @@ use warp::raygun::{
};
use warp::sync::{Arc, RwLock};
use warp::tesseract::Tesseract;
use warp_ipfs::config::Discovery;
use warp_ipfs::config::{Discovery, DiscoveryType};
use warp_ipfs::WarpIpfsBuilder;

#[derive(Debug, Parser)]
Expand All @@ -43,6 +44,8 @@ struct Opt {
#[clap(long)]
context: Option<String>,
#[clap(long)]
discovery_point: Option<Multiaddr>,
#[clap(long)]
direct: bool,
#[clap(long)]
disable_relay: bool,
Expand Down Expand Up @@ -87,9 +90,18 @@ async fn setup<P: AsRef<Path>>(
};

if !opt.direct || !opt.no_discovery {
let discovery_type = match &opt.discovery_point {
Some(addr) => {
config.ipfs_setting.bootstrap = false;
DiscoveryType::RzPoint {
addresses: vec![addr.clone()],
}
}
None => DiscoveryType::DHT,
};
config.store_setting.discovery = Discovery::Namespace {
namespace: opt.context.clone(),
discovery_type: Default::default(),
discovery_type,
};
}
if opt.disable_relay {
Expand Down

0 comments on commit 2173f08

Please sign in to comment.