Skip to content

Commit

Permalink
chore: Enable quic by default and change functions and logic
Browse files Browse the repository at this point in the history
  • Loading branch information
dariusc93 committed May 9, 2024
1 parent 88095bc commit a682392
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
6 changes: 3 additions & 3 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub struct Args {
#[clap(long)]
discovery: Option<DiscoveryMode>,
#[clap(long)]
enable_quic: bool,
disable_quic: bool,
#[clap(long)]
discovery_point: Option<String>,
#[cfg(debug_assertions)]
Expand Down Expand Up @@ -127,7 +127,7 @@ pub struct StaticArgs {
/// Disable discovery
pub discovery: DiscoveryMode,
/// Enable quic transport
pub enable_quic: bool,
pub disable_quic: bool,
// some features aren't ready for release. This field is used to disable such features.
pub production_mode: bool,
}
Expand Down Expand Up @@ -168,7 +168,7 @@ pub static STATIC_ARGS: Lazy<StaticArgs> = Lazy::new(|| {
login_config_path: uplink_path.join("login_config.json"),
use_mock,
discovery: args.discovery.unwrap_or_default(),
enable_quic: args.enable_quic,
disable_quic: args.disable_quic,
production_mode: cfg!(feature = "production_mode"),
}
});
Expand Down
4 changes: 2 additions & 2 deletions common/src/warp_runner/manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub async fn run(mut warp: Warp, notify: Arc<Notify>) {

async fn get_raygun_stream(rg: &mut Messaging) -> RayGunEventStream {
loop {
match rg.subscribe().await {
match rg.raygun_subscribe().await {
Ok(stream) => break stream,
Err(warp::error::Error::MultiPassExtensionUnavailable)
| Err(warp::error::Error::RayGunExtensionUnavailable) => {
Expand All @@ -100,7 +100,7 @@ async fn get_raygun_stream(rg: &mut Messaging) -> RayGunEventStream {

async fn get_multipass_stream(account: &mut Account) -> MultiPassEventStream {
loop {
match account.subscribe().await {
match account.multipass_subscribe().await {
Ok(stream) => break stream,
Err(e) => match e {
//Note: Used as a precaution for future checks
Expand Down
29 changes: 16 additions & 13 deletions common/src/warp_runner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,19 +384,22 @@ async fn warp_initialization(tesseract: Tesseract) -> Result<manager::Warp, warp
let path = &STATIC_ARGS.warp_path;
let mut config = Config::production(path);

*config.save_phrase_mut() = true; // TODO: This should be bound to a setting within Uplink so that the user can choose not to reveal the phrase for increased security.``
*config.bootstrap_mut() = Bootstrap::None;

let ipfs_setting = config.ipfs_setting_mut();
ipfs_setting.disable_quic = STATIC_ARGS.disable_quic;
ipfs_setting.portmapping = true;
ipfs_setting.agent_version = Some(format!("uplink/{}", env!("CARGO_PKG_VERSION")));

let store_setting = config.store_setting_mut();
// Discovery is disabled by default for now but may offload manual discovery through a separate service
// in the near future
config.store_setting.discovery = Discovery::from(&STATIC_ARGS.discovery);

config.save_phrase = true; // TODO: This should be bound to a setting within Uplink so that the user can choose not to reveal the phrase for increased security.``
config.bootstrap = Bootstrap::None;
config.ipfs_setting.disable_quic = !STATIC_ARGS.enable_quic;
config.ipfs_setting.portmapping = true;
config.ipfs_setting.agent_version = Some(format!("uplink/{}", env!("CARGO_PKG_VERSION")));
config.store_setting.emit_online_event = true;
config.store_setting.share_platform = true;
config.store_setting.update_events = UpdateEvents::Enabled;
config.store_setting.default_profile_picture = Some(Arc::new(|identity| {
store_setting.discovery = Discovery::from(&STATIC_ARGS.discovery);
store_setting.emit_online_event = true;
store_setting.share_platform = true;
store_setting.update_events = UpdateEvents::Enabled;
store_setting.default_profile_picture = Some(Arc::new(|identity| {
let mut content = plot_icon::generate_png(identity.did_key().to_string().as_bytes(), 512)
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?;

Expand All @@ -407,13 +410,13 @@ async fn warp_initialization(tesseract: Tesseract) -> Result<manager::Warp, warp
FileType::Mime("image/png".parse().expect("Correct mime")),
))
}));
config.thumbnail_size = (500, 500);
*config.thumbnail_size_mut() = (500, 500);

let (multipass, raygun, constellation) = WarpIpfsBuilder::default()
.set_tesseract(tesseract.clone())
.set_config(config)
.finalize()
.await?;
.await;

let blink = warp_blink_wrtc::BlinkImpl::new(multipass.clone()).await?;

Expand Down

0 comments on commit a682392

Please sign in to comment.