Skip to content

Commit

Permalink
Merge branch 'main' into feat/shuttle-gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
dariusc93 authored Nov 21, 2023
2 parents a6bb396 + e313206 commit 39e67c0
Show file tree
Hide file tree
Showing 13 changed files with 158 additions and 261 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ either = "1"
void = "1"

#ipfs dependency
rust-ipfs = "0.7.1"
rust-ipfs = "0.8.0"


# Blink related crates
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Interface Driven Distributed Data Service

### Overview

Warp can run as a single binary, providing an interface into the core technologies that run Satellite. This allows us to avoid rewriting the same tech over and over when developing for different platforms. Warp will work on most phones, tablets, computers, and even some consoles.
Warp can run as a single binary, providing an interface into the core technologies that run Satellite. This allows us to avoid rewriting the same tech over and over when developing for different platforms. Warp will work on most phones, tablets, computers, and consoles.

It provides abstractions to many different modules which are required to run Satellite. These modules include Messaging, Caching, File Sharing & Storage, RTC connections, and more. Because we focus on building these modules as interfaces first, then allow implementation layers to be built on top of these, it allows us to change the core technologies easily with no extra development required on the "front-end" stacks. This means we can jump from multiple blockchains or even some other type of decentralized solution without affecting the front-end application.
It provides abstractions to many different modules which are required to run Satellite. These modules include Messaging, Caching, File Sharing & Storage, RTC connections, and more. Because we focus on building these modules as interfaces first and then allow implementation layers to be built on top of these, we can easily change the core technologies with no extra development required on the "front-end" stacks. This means we can jump from multiple blockchains or decentralized solutions without affecting the front-end application.

Additionally, libraries to interface with Warp (will) exist in JavaScript (TypeScript), Java, Python, and more. So you can easily develop your own platforms and integrations on top of the Satellite tech stack. Lastly, a REST API service can be enabled for Warp, however, it should never be exposed outside of localhost.
Additionally, libraries to interface with Warp (will) exist in JavaScript (TypeScript), Java, Python, and more. So you can quickly develop your platforms and integrations on top of the Satellite tech stack. Lastly, a REST API service can be enabled for Warp. However, it should never be exposed outside of localhost.

### Build Requirement

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ fn write_mp4_header(
// there is no redundant coding in this sample
// padding: 0
// sample_is_non_sync_sample ... set this to 1?
// sample_degredation_priority
// sample_degradation_priority
flags: 0, //(2 << 26) | (2 << 24) | (2 << 22) | (2 << 20),
track_id: *track_id,
// stsd entry 1 is for Opus
Expand Down
10 changes: 4 additions & 6 deletions extensions/warp-ipfs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,15 @@ bytes.workspace = true
shuttle = { path = "../../tools/shuttle" }

[dev-dependencies]
fdlimit = "0.2"
bs58 = "0.4"
rustyline-async = "0.3"
comfy-table = "6.1"
fdlimit = "0.3"
rustyline-async = "0.4"
comfy-table = "7.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tracing-appender = "0.2"

clap = { version = "4.0", features = ["derive"] }
dirs = "4.0"

rpassword = "7.2"
rpassword = "7.3"


[features]
Expand Down
11 changes: 4 additions & 7 deletions extensions/warp-ipfs/examples/identity-interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use clap::Parser;
use comfy_table::Table;
use futures::prelude::*;
use rust_ipfs::Multiaddr;
use rustyline_async::{Readline, ReadlineError};
use rustyline_async::Readline;
use std::io::Write;
use std::path::PathBuf;
use std::str::FromStr;
Expand Down Expand Up @@ -151,9 +151,7 @@ async fn account(
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let opt = Opt::parse();
if fdlimit::raise_fd_limit().is_none() {
//raising fd limit
}
_ = fdlimit::raise_fd_limit().is_ok();

let file_appender = match &opt.path {
Some(path) => tracing_appender::rolling::hourly(path, "warp_mp_identity_interface.log"),
Expand Down Expand Up @@ -361,7 +359,7 @@ async fn main() -> anyhow::Result<()> {
}
}
line = rl.readline().fuse() => match line {
Ok(line) => {
Ok(rustyline_async::ReadlineEvent::Line(line)) => {
rl.add_history_entry(line.clone());
let mut cmd_line = line.trim().split(' ');
match cmd_line.next() {
Expand Down Expand Up @@ -792,8 +790,7 @@ async fn main() -> anyhow::Result<()> {
_ => continue
}
},
Err(ReadlineError::Interrupted) => break,
Err(ReadlineError::Eof) => break,
Ok(rustyline_async::ReadlineEvent::Eof) | Ok(rustyline_async::ReadlineEvent::Interrupted) => break,
Err(e) => {
writeln!(stdout, "Error: {e}")?;
}
Expand Down
4 changes: 1 addition & 3 deletions extensions/warp-ipfs/examples/ipfs-persistent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ async fn setup_persistent<P: AsRef<Path>>(
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let opt = Opt::parse();
if fdlimit::raise_fd_limit().is_none() {
//raising fd limit
}
_ = fdlimit::raise_fd_limit().is_ok();

let (_, mut filesystem) = setup_persistent(None, opt.path.clone(), &opt).await?;

Expand Down
12 changes: 5 additions & 7 deletions extensions/warp-ipfs/examples/messenger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use clap::Parser;
use comfy_table::Table;
use futures::prelude::*;
use rust_ipfs::Multiaddr;
use rustyline_async::{Readline, ReadlineError, SharedWriter};
use rustyline_async::{Readline, SharedWriter};
use std::collections::HashMap;
use std::io::Write;
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -147,9 +147,7 @@ async fn setup<P: AsRef<Path>>(
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let opt = Opt::parse();
if fdlimit::raise_fd_limit().is_none() {
//raising fd limit
}
_ = fdlimit::raise_fd_limit().is_ok();

let mut _log_guard = None;

Expand Down Expand Up @@ -305,7 +303,8 @@ async fn main() -> anyhow::Result<()> {
}
}
line = rl.readline().fuse() => match line {
Ok(line) => {
Ok(rustyline_async::ReadlineEvent::Line(line)) => {
rl.add_history_entry(line.clone());
let mut cmd_line = line.trim().split(' ');
match cmd_line.next() {
Some("/create") => {
Expand Down Expand Up @@ -1093,8 +1092,7 @@ async fn main() -> anyhow::Result<()> {
}
}
},
Err(ReadlineError::Interrupted) => break,
Err(ReadlineError::Eof) => break,
Ok(rustyline_async::ReadlineEvent::Eof) | Ok(rustyline_async::ReadlineEvent::Interrupted) => break,
Err(e) => {
writeln!(stdout, "Error: {e}")?;
}
Expand Down
112 changes: 24 additions & 88 deletions extensions/warp-ipfs/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,101 +113,37 @@ impl Default for RelayClient {
relay_address: vec![
//NYC-1
"/ip4/146.190.184.59/tcp/4001/p2p/12D3KooWCHWLQXTR2N6ukWM99pZYc4TM82VS7eVaDE4Ryk8ked8h".parse().unwrap(),
"/ip4/146.190.184.59/udp/4001/quic-v1/p2p/12D3KooWCHWLQXTR2N6ukWM99pZYc4TM82VS7eVaDE4Ryk8ked8h".parse().unwrap(),
//SF-1
"/ip4/64.225.88.100/udp/4001/quic-v1/p2p/12D3KooWMfyuTCbehQYy68zPH6vpGUwg8raKbrS7pd3qZrG7bFuB".parse().unwrap(),
"/ip4/64.225.88.100/tcp/4001/p2p/12D3KooWMfyuTCbehQYy68zPH6vpGUwg8raKbrS7pd3qZrG7bFuB".parse().unwrap(),
//NYC-1-EXP
"/ip4/24.199.86.91/tcp/46315/p2p/12D3KooWQcyxuNXxpiM7xyoXRZC7Vhfbh2yCtRg272CerbpFkhE6".parse().unwrap(),
"/ip4/24.199.86.91/tcp/46315/p2p/12D3KooWQcyxuNXxpiM7xyoXRZC7Vhfbh2yCtRg272CerbpFkhE6".parse().unwrap()
]
}
}
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Swarm {
/// Concurrent dial factor
pub dial_factor: u8,
pub notify_buffer_size: usize,
pub connection_buffer_size: usize,
pub limit: Option<ConnectionLimit>,
}

impl Default for Swarm {
fn default() -> Self {
Self {
dial_factor: 8, //Same dial factor as default for libp2p
notify_buffer_size: 32,
connection_buffer_size: 1024,
limit: None,
}
}
}

#[derive(Default, Debug, Clone, Serialize, Deserialize)]
pub struct ConnectionLimit {
pub max_pending_incoming: Option<u32>,
pub max_pending_outgoing: Option<u32>,
pub max_established_incoming: Option<u32>,
pub max_established_outgoing: Option<u32>,
pub max_established: Option<u32>,
pub max_established_per_peer: Option<u32>,
}

impl ConnectionLimit {
pub fn testing() -> Self {
Self {
max_pending_incoming: Some(10),
max_pending_outgoing: Some(10),
max_established_incoming: Some(32),
max_established_outgoing: Some(32),
max_established: None,
max_established_per_peer: None,
}
}

pub fn minimal() -> Self {
Self {
max_pending_incoming: Some(128),
max_pending_outgoing: Some(128),
max_established_incoming: Some(128),
max_established_outgoing: Some(128),
max_established: None,
max_established_per_peer: None,
}
}

pub fn recommended() -> Self {
Self {
max_pending_incoming: Some(512),
max_pending_outgoing: Some(512),
max_established_incoming: Some(512),
max_established_outgoing: Some(512),
max_established: None,
max_established_per_peer: None,
}
}

pub fn maximum() -> Self {
Self {
max_pending_incoming: Some(512),
max_pending_outgoing: Some(512),
max_established_incoming: Some(1024),
max_established_outgoing: Some(1024),
max_established: None,
max_established_per_peer: None,
}
}
// #[derive(Debug, Clone, Serialize, Deserialize)]
// pub struct Swarm {
// /// Concurrent dial factor
// pub dial_factor: u8,
// pub notify_buffer_size: usize,
// pub connection_buffer_size: usize,
// pub limit: Option<ConnectionLimit>,
// }

pub fn unrestricted() -> Self {
Self {
max_pending_incoming: None,
max_pending_outgoing: None,
max_established_incoming: None,
max_established_outgoing: None,
max_established: None,
max_established_per_peer: None,
}
}
}
// impl Default for Swarm {
// fn default() -> Self {
// Self {
// dial_factor: 8, //Same dial factor as default for libp2p
// notify_buffer_size: 32,
// connection_buffer_size: 1024,
// limit: None,
// }
// }
// }

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Pubsub {
Expand All @@ -227,13 +163,13 @@ pub struct IpfsSetting {
pub mdns: Mdns,
pub relay_client: RelayClient,
pub pubsub: Pubsub,
pub swarm: Swarm,
pub bootstrap: bool,
pub portmapping: bool,
pub agent_version: Option<String>,
/// Used for testing with a memory transport
pub memory_transport: bool,
pub dht_client: bool,
pub disable_quic: bool,
}

#[derive(Debug, Clone, Copy, Serialize, Deserialize, Default)]
Expand Down Expand Up @@ -363,7 +299,7 @@ impl Default for Config {
path: None,
network: Network::Ipfs,
bootstrap: Bootstrap::Ipfs,
listen_on: ["/ip4/0.0.0.0/tcp/0", "/ip6/::/tcp/0"]
listen_on: ["/ip4/0.0.0.0/tcp/0", "/ip4/0.0.0.0/udp/0/quic-v1"]
.iter()
.filter_map(|s| Multiaddr::from_str(s).ok())
.collect::<Vec<_>>(),
Expand All @@ -375,7 +311,7 @@ impl Default for Config {
store_setting: Default::default(),
enable_relay: false,
save_phrase: false,
max_storage_size: Some(1024 * 1024 * 1024),
max_storage_size: Some(10 * 1024 * 1024 * 1024),
max_file_size: Some(50 * 1024 * 1024),
thumbnail_size: (128, 128),
chunking: None,
Expand Down
Loading

0 comments on commit 39e67c0

Please sign in to comment.