Giter Site home page Giter Site logo

zeronetx / zeronet-rs Goto Github PK

View Code? Open in Web Editor NEW
69.0 69.0 8.0 609 KB

Rust Implementation of ZeroNet Protocol

Home Page: https://zeronet.dev

License: Other

Rust 58.57% CoffeeScript 6.86% CSS 6.78% JavaScript 26.84% HTML 0.95%
actix-web async p2p rust tokio-rs zeronet

zeronet-rs's People

Contributors

canewsin avatar fossabot avatar rex4539 avatar zolagonano avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

zeronet-rs's Issues

(Error) Can't open the ZeroNet homepage

I built this with cargo build --release and when I run cargo run, the log show this:

 INFO  zeronet::plugins::site_server::wrapper > Serving wrapper for zero://1HELLo...2Ri9d/
thread 'actix-rt|system:0|arbiter:0' panicked at src/plugins/site_server/wrapper.rs:81:45:
called `Result::unwrap()` on an `Err` value: WrapperKeyNotFound
 INFO  zeronet::plugins::site_server::wrapper > Serving wrapper for zero://1HELLo...2Ri9d/
thread 'actix-rt|system:0|arbiter:1' panicked at src/plugins/site_server/wrapper.rs:81:45:
called `Result::unwrap()` on an `Err` value: WrapperKeyNotFound

Build fails on latest nightly toolchain

Seems like drain_filter feature has been renamed to extract_if:
rust-lang/rust#43244

Errors:

error[E0635]: unknown feature `drain_filter`
 --> src/main.rs:1:12
  |
1 | #![feature(drain_filter)]
  |            ^^^^^^^^^^^^

error[E0599]: no method named `drain_filter` found for struct `Vec<std::result::Result<(bool, std::string::String, zerucontent::File), core::error::Error>>` in the current scope
   --> src/io/site.rs:329:24
    |
329 |         let errs = res.drain_filter(|res| res.is_err()).collect::<Vec<_>>();
    |                        ^^^^^^^^^^^^ method not found in `Vec<Result<(bool, String, File), Error>>`

error[E0599]: no method named `drain_filter` found for struct `Vec<std::string::String>` in the current scope
   --> src/io/utils.rs:320:11
    |
320 |     peers.drain_filter(|peer| !peer.is_empty()).collect()
    |           ^^^^^^^^^^^^ method not found in `Vec<String>`

error[E0599]: no method named `drain_filter` found for struct `Vec<std::result::Result<bool, core::error::Error>>` in the current scope
   --> src/io/site.rs:232:24
    |
232 |         let errs = res.drain_filter(|res| !res.is_ok()).collect::<Vec<_>>();
    |                        ^^^^^^^^^^^^ method not found in `Vec<Result<bool, Error>>`

error[E0599]: no method named `drain_filter` found for struct `Vec<std::result::Result<zerucontent::Content, core::error::Error>>` in the current scope
   --> src/io/site.rs:243:14
    |
242 |           let errs = content_res
    |  ____________________-
243 | |             .drain_filter(|res| !res.is_ok())
    | |             -^^^^^^^^^^^^ method not found in `Vec<Result<Content, Error>>`
    | |_____________|
    | 

error[E0599]: no method named `drain_filter` found for struct `Vec<std::result::Result<bool, core::error::Error>>` in the current scope
   --> src/io/site.rs:264:24
    |
264 |         let errs = res.drain_filter(|res| !res.is_ok()).collect::<Vec<_>>();
    |                        ^^^^^^^^^^^^ method not found in `Vec<Result<bool, Error>>`

error[E0599]: no method named `drain_filter` found for struct `Vec<IpPort>` in the current scope
  --> src/discovery/mod.rs:44:22
   |
42 |                   let mut _res: Vec<Peer> = res
   |  ___________________________________________-
43 | |                     .unwrap()
44 | |                     .drain_filter(|a| a.port > 1) //consider ips with no port
   | |                     -^^^^^^^^^^^^ method not found in `Vec<IpPort>`
   | |_____________________|
   | 

error: future cannot be sent between threads safely
   --> src/io/site.rs:465:62
    |
465 |       async fn init_download(&mut self) -> Result<bool, Error> {
    |  ______________________________________________________________^
466 | |         if !&self.site_path().is_dir() {
467 | |             fs::create_dir_all(self.site_path()).await?;
468 | |         }
...   |
480 | |         Ok(verified)
481 | |     }
    | |_____^ future created by async block is not `Send`
    |
note: opaque type is declared here
   --> src/io/site.rs:204:44
    |
204 |     async fn download_site_files(&self) -> Result<(), Error> {
    |                                            ^^^^^^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
   --> src/io/site.rs:465:14
    |
465 |     async fn init_download(&mut self) -> Result<bool, Error> {
    |              ^^^^^^^^^^^^^
note: future is not `Send` as it awaits another future which is not `Send`
   --> src/io/site.rs:475:21
    |
475 |             let _ = self.download_site_files().await;
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `impl futures::Future<Output = std::result::Result<(), core::error::Error>>`, which is not `Send`
    = note: required for the cast from `Pin<Box<[async block@src/io/site.rs:465:62: 481:6]>>` to `Pin<Box<(dyn futures::Future<Output = std::result::Result<bool, core::error::Error>> + std::marker::Send + 'async_trait)>>`

error: future cannot be sent between threads safely
   --> src/io/site.rs:465:62
    |
465 |       async fn init_download(&mut self) -> Result<bool, Error> {
    |  ______________________________________________________________^
466 | |         if !&self.site_path().is_dir() {
467 | |             fs::create_dir_all(self.site_path()).await?;
468 | |         }
...   |
480 | |         Ok(verified)
481 | |     }
    | |_____^ future created by async block is not `Send`
    |
note: opaque type is declared here
   --> src/io/site.rs:312:49
    |
312 |     pub async fn check_site_integrity(&self) -> Result<Vec<(String, zerucontent::File)>, Error> {
    |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: this item depends on auto traits of the hidden type, but may also be registering the hidden type. This is not supported right now. You can try moving the opaque type and the item that actually registers a hidden type into a new submodule
   --> src/io/site.rs:465:14
    |
465 |     async fn init_download(&mut self) -> Result<bool, Error> {
    |              ^^^^^^^^^^^^^
note: future is not `Send` as it awaits another future which is not `Send`
   --> src/io/site.rs:290:27
    |
290 |                 let res = self.check_site_integrity().await?;
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `impl futures::Future<Output = std::result::Result<Vec<(std::string::String, zerucontent::File)>, core::error::Error>>`, which is not `Send`
    = note: required for the cast from `Pin<Box<[async block@src/io/site.rs:465:62: 481:6]>>` to `Pin<Box<(dyn futures::Future<Output = std::result::Result<bool, core::error::Error>> + std::marker::Send + 'async_trait)>>`

error[E0599]: no method named `drain_filter` found for struct `Vec<std::string::String>` in the current scope
   --> src/io/utils.rs:333:14
    |
333 |     trackers.drain_filter(|peer| !peer.is_empty()).collect()
    |              ^^^^^^^^^^^^ method not found in `Vec<String>`

Some errors have detailed explanations: E0599, E0635.
For more information about an error, try `rustc --explain E0599`.
error: could not compile `zeronet` (bin "zeronet" test) due to 10 previous errors

Need to create a users.json

Problem: It is necessary to manually create a users.json.

$./zeronet 
Loading sites.json file
Loading users file
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/io/utils.rs:55:63
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

$./zeronet 
Loading sites.json file
Loading users file
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/io/utils.rs:55:63
stack backtrace:
   0: rust_begin_unwind
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/core/src/panicking.rs:143:14
   2: core::result::unwrap_failed
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/core/src/result.rs:1785:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/core/src/result.rs:1078:23
   4: zeronet::io::utils::load_users_file
             at /home/bandura/Downloads/zeronet-rs/src/io/utils.rs:55:26
   5: <zeronet::environment::USER_STORAGE as core::ops::deref::Deref>::deref::__static_ref_initialize
             at /home/bandura/Downloads/zeronet-rs/src/environment.rs:17:58
   6: core::ops::function::FnOnce::call_once
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/core/src/ops/function.rs:227:5
   7: lazy_static::lazy::Lazy<T>::get::{{closure}}
             at /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/inline_lazy.rs:31:29
   8: std::sync::once::Once::call_once::{{closure}}
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/std/src/sync/once.rs:270:41
   9: std::sync::once::Once::call_inner
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/std/src/sync/once.rs:428:21
  10: std::sync::once::Once::call_once
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/std/src/sync/once.rs:270:9
  11: lazy_static::lazy::Lazy<T>::get
             at /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/inline_lazy.rs:30:9
  12: <zeronet::environment::USER_STORAGE as core::ops::deref::Deref>::deref::__stability
             at /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/lib.rs:142:21
  13: <zeronet::environment::USER_STORAGE as core::ops::deref::Deref>::deref
             at /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-1.4.0/src/lib.rs:144:17
  14: zeronet::main::{{closure}}
             at /home/bandura/Downloads/zeronet-rs/src/main.rs:26:25
  15: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/core/src/future/mod.rs:91:19
  16: tokio::park::thread::CachedParkThread::block_on::{{closure}}
             at /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/park/thread.rs:263:54
  17: tokio::coop::with_budget::{{closure}}
             at /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:102:9
  18: std::thread::local::LocalKey<T>::try_with
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/std/src/thread/local.rs:442:16
  19: std::thread::local::LocalKey<T>::with
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/std/src/thread/local.rs:418:9
  20: tokio::coop::with_budget
             at /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:95:5
  21: tokio::coop::budget
             at /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:72:5
  22: tokio::park::thread::CachedParkThread::block_on
             at /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/park/thread.rs:263:31
  23: tokio::runtime::enter::Enter::block_on
             at /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/enter.rs:151:13
  24: tokio::runtime::thread_pool::ThreadPool::block_on
             at /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/thread_pool/mod.rs:73:9
  25: tokio::runtime::Runtime::block_on
             at /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/mod.rs:477:43
  26: zeronet::main
             at /home/bandura/Downloads/zeronet-rs/src/main.rs:93:5
  27: core::ops::function::FnOnce::call_once
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

$./zeronet  --version
Loading sites.json file
ZeroNetX 0.8.0 r4800

run from zeronet-rs/target/debug

same happen when I run the binary from https://github.com/canewsin/zeronet-rs/releases

Returns 400 error

(using git-bash as my terminal)

$ curl 127.0.0.1:42110/1HELLoE3sFD9569CLCbHEAVqvqV7U2Ri9d -v
*   Trying 127.0.0.1:42110...
* Connected to 127.0.0.1 (127.0.0.1) port 42110 (#0)
> GET /1HELLoE3sFD9569CLCbHEAVqvqV7U2Ri9d HTTP/1.1
> Host: 127.0.0.1:42110
> User-Agent: curl/7.83.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 400 Bad Request
< content-length: 0
< date: Mon, 29 Aug 2022 20:28:02 GMT
<
* Connection #0 to host 127.0.0.1 left intact
$ RUST_BACKTRACE=full ./zeronet.exe siteDownload -s 1HELLoE3sFD9569CLCbHEAVqvqV7U2Ri9d
 ERROR zeronet::discovery > Error : MissingError
 ERROR zeronet::discovery > Error : MissingError
 ERROR zeronet::discovery > pn4q2zzt2pw4nk7yidxvsxmydko7dfibuzxdswi6gu6ninjpofvqs2id.onion:15441
 ERROR zeronet::discovery > Error : MissingError
 ERROR zeronet::discovery > ftkjyez23k3hpifg2rjsjzxthn5mwfbinldzbynaf2rbvchiy2sm7had.onion:15441
 ERROR zeronet::discovery > Error : MissingError
 ERROR zeronet::discovery > pqfft64vab6uc7d6u5pu72maqon3ekjobihda57mzedolg4pjenwbzid.onion:21255
 ERROR zeronet::discovery > 44dd5vynh23r3f3smrk2uadrxtb2yx7jppmi2cyqefcy3t62cjem2iid.onion:15441
 ERROR zeronet::discovery > Error : MissingError
 ERROR zeronet::discovery > kiufiiwdax7giphlnkj6fwivf4wgbohy2mdiipfujslnkvl2agux6nad.onion:15441
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src\main.rs:51:67
stack backtrace:
   0:     0x7ff731b37de6 - <unknown>
   1:     0x7ff731b5460b - <unknown>
   2:     0x7ff731b300fa - <unknown>
   3:     0x7ff731b3a4c4 - <unknown>
   4:     0x7ff731b3a0fa - <unknown>
   5:     0x7ff731b3acb1 - <unknown>
   6:     0x7ff731b3ab7a - <unknown>
   7:     0x7ff731b3880f - <unknown>
   8:     0x7ff731b3a880 - <unknown>
   9:     0x7ff731d2bce5 - rustsecp256k1_v0_2_0_ecdsa_verify
  10:     0x7ff731d2bb8c - rustsecp256k1_v0_2_0_ecdsa_verify
  11:     0x7ff73151373a - <unknown>
  12:     0x7ff7312d0bcf - <unknown>
  13:     0x7ff7312aecd6 - <unknown>
  14:     0x7ff7314eb20a - <unknown>
  15:     0x7ff7312d09bc - <unknown>
  16:     0x7ff731496028 - <unknown>
  17:     0x7ff7312ae83d - <unknown>
  18:     0x7ff731495779 - <unknown>
  19:     0x7ff7312dfaa9 - <unknown>
  20:     0x7ff73149ff2c - <unknown>
  21:     0x7ff7313b867a - <unknown>
  22:     0x7ff7314abf65 - <unknown>
  23:     0x7ff731b29800 - <unknown>
  24:     0x7ff73149ffa7 - <unknown>
  25:     0x7ff731cee74c - rustsecp256k1_v0_2_0_ecdsa_verify
  26:     0x7ff84c19244d - BaseThreadInitThunk
  27:     0x7ff84d2edf78 - RtlUserThreadStart

Failed to download zite: Error: Err("Content verification failed for 17dKzaJm557RqT4ujWKrGf28cmYTGviRmr")

$./zeronet siteDownload -s "17dKzaJm557RqT4ujWKrGf28cmYTGviRmr"
Loading sites.json file
Loading users file
Loading user: 1FdDwDNWJLxCBoBcVtmbKgohofi7r5Wmiq
Downloading Site
Error: Err("Content verification failed for 17dKzaJm557RqT4ujWKrGf28cmYTGviRmr")

$./zeronet siteDownload -s "17dKzaJm557RqT4ujWKrGf28cmYTGviRmr"
Loading sites.json file
Loading users file
Loading user: 1FdDwDNWJLxCBoBcVtmbKgohofi7r5Wmiq

$./zeronet siteVerify -s "17dKzaJm557RqT4ujWKrGf28cmYTGviRmr"
Loading sites.json file
Loading users file
Loading user: 1FdDwDNWJLxCBoBcVtmbKgohofi7r5Wmiq
Error: Err("Content verification failed for 17dKzaJm557RqT4ujWKrGf28cmYTGviRmr")

with the second try it works

Failed to build: error[E0554]: `#![feature]` may not be used on the stable release channel

$cargo build
  Downloaded bitflags v1.2.1
  Downloaded block-buffer v0.10.2
  Downloaded aho-corasick v0.7.18
  Downloaded futures-core v0.3.21
  Downloaded cc v1.0.73
  Downloaded digest v0.10.3
  Downloaded futures-channel v0.3.21
  Downloaded log v0.3.9
  Downloaded rand v0.6.5
  Downloaded rand v0.8.5
  Downloaded rand_chacha v0.1.1
  Downloaded rand_core v0.3.1
  Downloaded rand_core v0.4.2
  Downloaded nom v2.2.1
  Downloaded futures-sink v0.3.21
  Downloaded futures-executor v0.3.21
  Downloaded futures-io v0.3.21
  Downloaded pin-utils v0.1.0
  Downloaded itertools v0.10.3
  Downloaded miniz_oxide v0.4.4
  Downloaded lock_api v0.4.6
  Downloaded once_cell v1.10.0
  Downloaded parking_lot_core v0.9.1
  Downloaded scopeguard v1.1.0
  Downloaded futures-util v0.3.21
  Downloaded hashlink v0.7.0
  Downloaded parking_lot v0.12.0
  Downloaded rand_hc v0.1.0
  Downloaded rand_jitter v0.1.4
  Downloaded rand_xorshift v0.1.1
  Downloaded rand_os v0.1.3
  Downloaded rand_pcg v0.1.2
  Downloaded ripemd160 v0.9.1
  Downloaded rmp v0.8.10
  Downloaded rmpv v1.0.0
  Downloaded secp256k1 v0.20.3
  Downloaded sha2 v0.9.9
  Downloaded sha2 v0.10.2
  Downloaded sha1 v0.10.1
  Downloaded strsim v0.10.0
  Downloaded secp256k1-sys v0.3.0
  Downloaded secp256k1 v0.19.0
  Downloaded rmp-serde v1.0.0
  Downloaded tokio-macros v1.7.0
  Downloaded vcpkg v0.2.15
  Downloaded signal-hook-registry v1.2.2
  Downloaded tor v0.1.0
  Downloaded bech32 v0.7.3
  Downloaded bech32 v0.8.1
  Downloaded backtrace v0.3.64
  Downloaded autocfg v0.1.7
  Downloaded bitcoin_hashes v0.10.0
  Downloaded smallvec v1.8.0
  Downloaded object v0.27.1
  Downloaded textwrap v0.15.0
  Downloaded async-trait v0.1.52
  Downloaded adler v1.0.2
  Downloaded regex v1.5.5
  Downloaded serde_derive v1.0.136
  Downloaded serde v1.0.136
  Downloaded serde_json v1.0.79
  Downloaded socket2 v0.4.4
  Downloaded termcolor v1.1.3
  Downloaded either v1.6.1
  Downloaded bitcoin_hashes v0.9.7
  Downloaded rand_isaac v0.1.1
  Downloaded serde_bytes v0.11.5
  Downloaded rusqlite v0.27.0
  Downloaded slab v0.4.2
  Downloaded async-recursion v1.0.0
  Downloaded rustc-demangle v0.1.21
  Downloaded regex-syntax v0.6.25
  Downloaded bytes v1.1.0
  Downloaded crypto-common v0.1.3
  Downloaded addr2line v0.17.0
  Downloaded clap v3.1.6
  Downloaded syn v1.0.86
  Downloaded os_str_bytes v6.0.0
  Downloaded futures-task v0.3.21
  Downloaded futures-macro v0.3.21
  Downloaded failure_derive v0.1.8
  Downloaded fallible-streaming-iterator v0.1.9
  Downloaded fallible-iterator v0.2.0
  Downloaded bitcoin v0.25.2
  Downloaded futures v0.3.21
  Downloaded memchr v2.4.1
  Downloaded koibumi-base32 v0.0.2
  Downloaded pin-project-lite v0.2.8
  Downloaded getrandom v0.2.5
  Downloaded i2p v0.0.1
  Downloaded indexmap v1.8.0
  Downloaded generic-array v0.14.5
  Downloaded failure v0.1.8
  Downloaded bitcoin v0.27.1
  Downloaded secp256k1-sys v0.4.2
  Downloaded tokio v1.17.0
  Downloaded gimli v0.26.1
  Downloaded libc v0.2.119
  Downloaded libsqlite3-sys v0.24.1
  Downloaded 99 crates (11.9 MB) in 3.90s (largest was `libsqlite3-sys` at 4.8 MB)
   Compiling libc v0.2.119
   Compiling proc-macro2 v1.0.36
   Compiling unicode-xid v0.2.1
   Compiling cfg-if v1.0.0
   Compiling syn v1.0.86
   Compiling autocfg v1.0.1
   Compiling version_check v0.9.4
   Compiling cc v1.0.73
   Compiling memchr v2.4.1
   Compiling typenum v1.15.0
   Compiling autocfg v0.1.7
   Compiling rand_core v0.4.2
   Compiling serde_derive v1.0.136
   Compiling serde v1.0.136
   Compiling once_cell v1.10.0
   Compiling log v0.4.14
   Compiling ryu v1.0.5
   Compiling futures-core v0.3.21
   Compiling futures-channel v0.3.21
   Compiling serde_json v1.0.79
   Compiling futures-task v0.3.21
   Compiling itoa v1.0.1
   Compiling pin-project-lite v0.2.8
   Compiling futures-sink v0.3.21
   Compiling cpufeatures v0.2.1
   Compiling smallvec v1.8.0
   Compiling gimli v0.26.1
   Compiling parking_lot_core v0.9.1
   Compiling failure_derive v0.1.8
   Compiling futures-util v0.3.21
   Compiling adler v1.0.2
   Compiling byteorder v1.4.3
   Compiling scopeguard v1.1.0
   Compiling bitflags v1.2.1
   Compiling vcpkg v0.2.15
   Compiling futures-io v0.3.21
   Compiling rustc-demangle v0.1.21
   Compiling pin-utils v0.1.0
   Compiling pkg-config v0.3.24
   Compiling opaque-debug v0.3.0
   Compiling slab v0.4.2
   Compiling bech32 v0.7.3
   Compiling base64 v0.13.0
   Compiling bitcoin_hashes v0.9.7
   Compiling hex v0.4.3
   Compiling async-trait v0.1.52
   Compiling nom v2.2.1
   Compiling ppv-lite86 v0.2.16
   Compiling bytes v1.1.0
   Compiling lazy_static v1.4.0
   Compiling either v1.6.1
   Compiling fallible-streaming-iterator v0.1.9
   Compiling bitcoin_hashes v0.10.0
   Compiling fallible-iterator v0.2.0
   Compiling regex-syntax v0.6.25
   Compiling strsim v0.10.0
   Compiling bech32 v0.8.1
   Compiling termcolor v1.1.3
   Compiling tor v0.1.0
   Compiling textwrap v0.15.0
   Compiling generic-array v0.14.5
   Compiling ahash v0.7.6
   Compiling num-traits v0.2.14
   Compiling miniz_oxide v0.4.4
   Compiling num-integer v0.1.44
   Compiling indexmap v1.8.0
   Compiling num-bigint v0.4.3
   Compiling rand_core v0.3.1
   Compiling rand_jitter v0.1.4
   Compiling rand_chacha v0.1.1
   Compiling rand_pcg v0.1.2
   Compiling rand v0.6.5
   Compiling lock_api v0.4.6
   Compiling secp256k1-sys v0.3.0
   Compiling backtrace v0.3.64
   Compiling secp256k1-sys v0.4.2
   Compiling koibumi-base32 v0.0.2
   Compiling itertools v0.10.3
   Compiling libsqlite3-sys v0.24.1
   Compiling addr2line v0.17.0
   Compiling rand_xorshift v0.1.1
   Compiling rand_hc v0.1.0
   Compiling rand_isaac v0.1.1
   Compiling object v0.27.1
   Compiling aho-corasick v0.7.18
   Compiling os_str_bytes v6.0.0
   Compiling quote v1.0.7
   Compiling getrandom v0.2.5
   Compiling rand_os v0.1.3
   Compiling rand v0.4.6
   Compiling signal-hook-registry v1.2.2
   Compiling socket2 v0.4.4
   Compiling num_cpus v1.13.0
   Compiling atty v0.2.14
   Compiling time v0.1.44
   Compiling log v0.3.9
   Compiling mio v0.8.0
   Compiling rand_core v0.6.3
   Compiling regex v1.5.5
   Compiling parking_lot v0.12.0
   Compiling rand v0.3.23
   Compiling rmp v0.8.10
   Compiling hashbrown v0.11.2
   Compiling rand_chacha v0.3.1
   Compiling block-buffer v0.9.0
   Compiling digest v0.9.0
   Compiling block-buffer v0.10.2
   Compiling crypto-common v0.1.3
   Compiling secp256k1 v0.20.3
   Compiling i2p v0.0.1
   Compiling rmpv v1.0.0
   Compiling chrono v0.4.19
   Compiling rand v0.8.5
   Compiling sha2 v0.9.9
   Compiling ripemd160 v0.9.1
   Compiling secp256k1 v0.19.0
   Compiling hashlink v0.7.0
   Compiling digest v0.10.3
   Compiling bitcoin v0.27.1
   Compiling synstructure v0.12.6
   Compiling bitcoin v0.25.2
   Compiling sha2 v0.10.2
   Compiling sha1 v0.10.1
   Compiling clap v3.1.6
   Compiling thiserror-impl v1.0.22
   Compiling futures-macro v0.3.21
   Compiling tokio-macros v1.7.0
   Compiling async-recursion v1.0.0
   Compiling failure v0.1.8
   Compiling tokio v1.17.0
   Compiling thiserror v1.0.22
   Compiling zeronet_cryptography v0.2.0 (/home/bandura/Downloads/zeronet-rs/zeronet_cryptography)
   Compiling futures-executor v0.3.21
   Compiling futures v0.3.21
   Compiling serde_bytes v0.11.5
   Compiling rmp-serde v1.0.0
   Compiling bincode v1.3.3
   Compiling json_filter_sorted v0.1.1 (/home/bandura/Downloads/zeronet-rs/json_filter_sorted)
   Compiling rusqlite v0.27.0
   Compiling zeronet_protocol v0.1.9 (/home/bandura/Downloads/zeronet-rs/zeronet_protocol)
   Compiling zerucontent v0.1.0 (/home/bandura/Downloads/zeronet-rs/zerucontent)
   Compiling zeronet v0.1.0 (/home/bandura/Downloads/zeronet-rs)
warning: unused import: `protocol::Protocol`
  --> src/main.rs:20:5
   |
20 |     protocol::Protocol,
   |     ^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

error[E0554]: `#![feature]` may not be used on the stable release channel
 --> src/main.rs:1:12
  |
1 | #![feature(drain_filter)]
  |            ^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0554`.
warning: `zeronet` (bin "zeronet") generated 1 warning
error: could not compile `zeronet` due to previous error; 1 warning emitted

$cargo --version
cargo 1.59.0 (49d8809dc 2022-02-10)

Failed to download zite: EOF while parsing a value

$./zeronet siteDownload -s "1Keke3V7Fn8bPt82QyhNHkv5gx5NnK9Umu"
Loading sites.json file
Loading users file
Loading user: 1FdDwDNWJLxCBoBcVtmbKgohofi7r5Wmiq
Downloading Site
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error("EOF while parsing a value", line: 1, column: 0)', zerucontent/src/content.rs:108:68
stack backtrace:
   0: rust_begin_unwind
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/core/src/panicking.rs:143:14
   2: core::result::unwrap_failed
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/core/src/result.rs:1785:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/core/src/result.rs:1078:23
   4: zerucontent::content::Content::from_buf
             at /home/bandura/Downloads/zeronet-rs/zerucontent/src/content.rs:108:39
   5: zeronet::io::site::<impl zeronet::core::site::Site>::load_content::{{closure}}
             at /home/bandura/Downloads/zeronet-rs/src/io/site.rs:155:23
   6: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/core/src/future/mod.rs:91:19
   7: zeronet::io::site::<impl zeronet::core::io::SiteIO for zeronet::core::site::Site>::init_download::{{closure}}
             at /home/bandura/Downloads/zeronet-rs/src/io/site.rs:251:43
   8: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/core/src/future/mod.rs:91:19
   9: <core::pin::Pin<P> as core::future::future::Future>::poll
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/core/src/future/future.rs:124:9
  10: zeronet::common::download_site::{{closure}}
             at /home/bandura/Downloads/zeronet-rs/src/common.rs:106:29
  11: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/core/src/future/mod.rs:91:19
  12: zeronet::main::{{closure}}
             at /home/bandura/Downloads/zeronet-rs/src/main.rs:39:59
  13: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/core/src/future/mod.rs:91:19
  14: tokio::park::thread::CachedParkThread::block_on::{{closure}}
             at /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/park/thread.rs:263:54
  15: tokio::coop::with_budget::{{closure}}
             at /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:102:9
  16: std::thread::local::LocalKey<T>::try_with
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/std/src/thread/local.rs:442:16
  17: std::thread::local::LocalKey<T>::with
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/std/src/thread/local.rs:418:9
  18: tokio::coop::with_budget
             at /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:95:5
  19: tokio::coop::budget
             at /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/coop.rs:72:5
  20: tokio::park::thread::CachedParkThread::block_on
             at /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/park/thread.rs:263:31
  21: tokio::runtime::enter::Enter::block_on
             at /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/enter.rs:151:13
  22: tokio::runtime::thread_pool::ThreadPool::block_on
             at /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/thread_pool/mod.rs:73:9
  23: tokio::runtime::Runtime::block_on
             at /home/bandura/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.17.0/src/runtime/mod.rs:477:43
  24: zeronet::main
             at /home/bandura/Downloads/zeronet-rs/src/main.rs:93:5
  25: core::ops::function::FnOnce::call_once
             at /rustc/1d9c262eea411ec5230f8a4c9ba50b3647064da4/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Failed to download zite: Error: Err("Site Integrity Check Failed")

$./zeronet siteDownload -s "1iD5ZQJMNXu43w1qLB8sfdHVKppVMduGz"
Loading sites.json file
Loading users file
Loading user: 1FdDwDNWJLxCBoBcVtmbKgohofi7r5Wmiq
Downloading Site
Error: Err("Site Integrity Check Failed")

$./zeronet siteDownload -s "1iD5ZQJMNXu43w1qLB8sfdHVKppVMduGz"
Loading sites.json file
Loading users file
Loading user: 1FdDwDNWJLxCBoBcVtmbKgohofi7r5Wmiq

$./zeronet siteVerify -s "1iD5ZQJMNXu43w1qLB8sfdHVKppVMduGz"
Loading sites.json file
Loading users file
Loading user: 1FdDwDNWJLxCBoBcVtmbKgohofi7r5Wmiq
Error: Err("Site Integrity Check Failed")

1iD5ZQJMNXu43w1qLB8sfdHVKppVMduGz is ZeroID

[ New Feature ] Block Storage for File Objects

Background:

Current ZeroNet Storage Acts as single place for single site, means all site files stored in Site Directory. This is convenience for user to browse files, but most users don't browse or aware of Zite System internals. After Introduction for browse files feature in sidebar, users tend to use that instead of manually browsing site dir.

Cons of Current Storage:

File Duplication for both site side resources as well as user storage due to the fact that he needs to host exact same file twice.
Network availability, since files are treated as 2 separate files, availability of file is low on network, even same file has high availability on another site.

Solution:

Block Storage for File Objects, Each File has sha512 hash in content.json, So using this site Files are stored at single directory, only files exists in site are manifest files(content.json etc.) and files that are marked as ignored in content.json. These files can be encrypted using user side keys to protect files from malicious access which inturn benifits the user. On user side, Only change they see is different storage system from existing one, but user can choose to turn off this for own/single/all sites or for small files, for eg site devs who use IDE for site development.

Error while downloading a site: "range end index 20 out of range for slice of length 16"

Error is caused by calling drain method on resp_buf in discovery::tracker::udp::udp_announce when the vector's length is smaller than 20:

resp_buf.drain(0..20);

Here's the error (I printed length to make sure it's that):

resp_buf length before calling drain: 110
resp_buf length before calling drain: 16
thread 'main' panicked at 'range end index 20 out of range for slice of length 16', /rustc/993deaa0bf8bab9dd3eadfd1fbeb093328e95afe/library/alloc/src/vec/mod.rs:1993:36

Python Implementation Tracker

Modules Need to be Implemeted(Python Repo)

  • #29
  • #30
  • Content
  • File(FileServer)
  • Database
  • Connection
  • Peer(Peer Commands)
  • Ui(Server, Websockets)
  • Crypt
  • Translate
  • Tor
  • utils(diff, msgpack, upnp punch, rate limit etc)
  • Plugin

Failed to download zite: InvalidJson(Error("missing field `body`", line: 0, column: 0))

$./zeronet siteDownload -s "1H51ZJ118ubwYAceszZ6CRMp4MPaSwcMh1"
Loading sites.json file
Loading users file
Loading user: 1FdDwDNWJLxCBoBcVtmbKgohofi7r5Wmiq
Downloading Site
InvalidJson(Error("missing field `body`", line: 0, column: 0))

$./zeronet siteDownload -s "1H51ZJ118ubwYAceszZ6CRMp4MPaSwcMh1"
Loading sites.json file
Loading users file
Loading user: 1FdDwDNWJLxCBoBcVtmbKgohofi7r5Wmiq

with the second try it works

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.