diff --git a/Cargo.lock b/Cargo.lock index 2d269c1..a0454c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2543,7 +2543,7 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "scs" -version = "0.1.1" +version = "0.1.2" dependencies = [ "anyhow", "assert_fs", diff --git a/config.yml b/config.yml index 6d6f08f..8c98ed6 100644 --- a/config.yml +++ b/config.yml @@ -16,6 +16,6 @@ message: #Optional during receive file: #Optional during receive - "./dev_build.sh" debug: 1 #Compulsory. 0 is for off and 1 and above for on -blacklists: -- 127.0.0.1 -- 34.138.139.178 \ No newline at end of file +# blacklists: +# - 127.0.0.1 +# - 34.138.139.178 \ No newline at end of file diff --git a/npm/package.json b/npm/package.json index e0c4d57..f014e35 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,13 +1,13 @@ { "name": "@onboardbase/secure-share", - "version": "0.1.1", + "version": "0.1.2", "description": "Share anything with teammates across machines via CLI", "scripts": { "test": "jest", "postinstall": "node ./install.js" }, "bin": { - "share": "run.js" + "scs": "run.js" }, "repository": { "type": "git", diff --git a/share/Cargo.toml b/share/Cargo.toml index 1c8a048..ea30b0a 100644 --- a/share/Cargo.toml +++ b/share/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "scs" -version = "0.1.1" +version = "0.1.2" edition = "2021" default-run = "scs" description = "Open source p2p share for devs to share anything with teammates across machines securely." diff --git a/share/src/main.rs b/share/src/main.rs index 1c312cf..51e1be3 100644 --- a/share/src/main.rs +++ b/share/src/main.rs @@ -14,7 +14,7 @@ mod network; #[derive(Parser, Debug)] #[command(name = "scs")] #[command(author = "Onboardbase. ")] -#[command(version = "0.1.1")] +#[command(version = "0.1.2")] #[command(about = "Share anything with teammates across machines via CLI.", long_about = None)] pub struct Cli { /// Separated list of secrets to share. Key-Value pair is seperated by a comma. "my_key,my_value" diff --git a/share/src/network/hole_puncher.rs b/share/src/network/hole_puncher.rs index 3e13382..d775848 100644 --- a/share/src/network/hole_puncher.rs +++ b/share/src/network/hole_puncher.rs @@ -141,6 +141,7 @@ pub fn punch(mode: Mode, remote_peer_id: Option, config: Config) -> Resu } } let mut connection_deets = ConnectionDetails::new(); + block_on(async { loop { match swarm.next().await.unwrap() { @@ -167,19 +168,27 @@ pub fn punch(mode: Mode, remote_peer_id: Option, config: Config) -> Resu // println!("deetttss {:#?}", connection_id); error!("This IP address is present in your blacklist."); swarm.close_connection(connection_id); + exit(1); } if !is_ip_whitelisted(&event, &config) { + error!("This IP address is not present in your whitleist."); swarm.close_connection(connection_id); + exit(1); } } SwarmEvent::Behaviour(Event::Ping(_)) => {} SwarmEvent::IncomingConnection { connection_id, .. } => { - connection_deets.save_id(connection_id); + debug!("INCOMING CONNECTION: {:?}", connection_id); } SwarmEvent::ConnectionEstablished { - peer_id, endpoint, .. + peer_id, + endpoint, + connection_id, + .. } => { + connection_deets.save_id(connection_id); + let addr = endpoint.get_remote_address(); info!("Established connection to {peer_id} via {addr}");