Lightweight p2p library. Support build robust stable connection on p2p/distributed network.

Overview

crate doc

Chamomile

Build a robust stable connection on p2p network

features

  • Support build a robust stable connection between two peers on the p2p network.
  • Support permissionless network.
  • Support permissioned network (distributed network).
  • DHT-based & Relay connection.
  • Diff transports: QUIC(default) / TCP / UDP-Based Special Protocol.
  • Multiple transports connecting at same runtime.

Simple test.

  • A: cargo run --example permissionless 127.0.0.1:8000
  • B: cargo run --example permissionless 127.0.0.1:8001 127.0.0.1:8000
  • C: cargo run --example permissionless 127.0.0.1:8002 127.0.0.1:8000

If not support 127.0.0.1 binding, you can change to 0.0.0.0 and try again.

Relay test.

  • A: cargo run --example relay 192.168.xx.xx:8000
    • this ip is your LAN address, it will do relay work.
  • B: cargo run --example relay 127.0.0.1:8001 192.168.xx.xx:8000
    • start waiting stable connected by relay.
  • C: cargo run --example relay 127.0.0.1:8002 192.168.xx.xx:8000 XX..
    • XX.. is above's B network peer id will connected it.
    • And if change B and C 127.0.0.1 to 0.0.0.0, they will automatically connect after the handshake is successful, no longer need relay.

Design point

  • Mobile phones, IoT devices, PC and servers are first-class citizens
  • Ability to adapt to the transmission and penetration of complex network environments
  • Support for springboard function, virtual connection with other nodes, build virtual DHT
  • Encrypted transmission and secure DHT protection
  • It can support all interconnections and single-center connections under the LAN, and can also support DHT in the public network environment
  • Automatically switch the connection according to the number of connections and the network environment
  • If Alice use QUIC, Bob use TCP, they can still connect and communicate with each other.

For more information, please visit:

License

This project is licensed under either of

at your option.

Comments
  • Cannot run `permissionless` example

    Cannot run `permissionless` example

    Just tried to run one of the examples.

    Backtrace
    λ ~/Downloads/chamomile/ main RUST_BACKTRACE=1 cargo run --example permissionless 127.0.0.1:8000
        Finished dev [unoptimized + debuginfo] target(s) in 0.14s
         Running `target/debug/examples/permissionless '127.0.0.1:8000'`
    thread 'main' panicked at 'failed to set global default subscriber: SetGlobalDefaultError { _no_construct: () }', /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.3.14/src/util.rs:91:14
    stack backtrace:
       0: rust_begin_unwind
       1: core::panicking::panic_fmt
       2: core::result::unwrap_failed
       3: core::result::Result<T,E>::expect
                 at /builddir/build/BUILD/rustc-1.62.0-src/library/core/src/result.rs:1035:23
       4: tracing_subscriber::util::SubscriberInitExt::init
                 at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.3.14/src/util.rs:90:9
       5: console_subscriber::builder::Builder::init
                 at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/console-subscriber-0.1.6/src/builder.rs:346:9
       6: console_subscriber::builder::init
                 at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/console-subscriber-0.1.6/src/builder.rs:533:5
       7: permissionless::main::{{closure}}
                 at ./examples/permissionless.rs:7:5
       8: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
                 at /builddir/build/BUILD/rustc-1.62.0-src/library/core/src/future/mod.rs:91:19
       9: <tracing::instrument::Instrumented<T> as core::future::future::Future>::poll
                 at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-0.1.35/src/instrument.rs:272:9
      10: tokio::park::thread::CachedParkThread::block_on::{{closure}}
                 at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.20.0/src/park/thread.rs:263:54
      11: tokio::coop::with_budget::{{closure}}
                 at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.20.0/src/coop.rs:102:9
      12: std::thread::local::LocalKey<T>::try_with
                 at /builddir/build/BUILD/rustc-1.62.0-src/library/std/src/thread/local.rs:445:16
      13: std::thread::local::LocalKey<T>::with
                 at /builddir/build/BUILD/rustc-1.62.0-src/library/std/src/thread/local.rs:421:9
      14: tokio::coop::with_budget
                 at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.20.0/src/coop.rs:95:5
      15: tokio::coop::budget
                 at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.20.0/src/coop.rs:72:5
      16: tokio::park::thread::CachedParkThread::block_on
                 at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.20.0/src/park/thread.rs:263:31
      17: tokio::runtime::enter::Enter::block_on
                 at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.20.0/src/runtime/enter.rs:152:13
      18: tokio::runtime::thread_pool::ThreadPool::block_on
                 at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.20.0/src/runtime/thread_pool/mod.rs:90:9
      19: tokio::runtime::Runtime::block_on
                 at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.20.0/src/runtime/mod.rs:484:43
      20: permissionless::main
                 at ./examples/permissionless.rs:60:5
      21: core::ops::function::FnOnce::call_once
                 at /builddir/build/BUILD/rustc-1.62.0-src/library/core/src/ops/function.rs:248:5
    
    
    Full backtrace
    λ ~/Downloads/chamomile/ main RUST_BACKTRACE=full cargo run --example permissionless 127.0.0.1:8000
        Finished dev [unoptimized + debuginfo] target(s) in 0.14s
         Running `target/debug/examples/permissionless '127.0.0.1:8000'`
    thread 'main' panicked at 'failed to set global default subscriber: SetGlobalDefaultError { _no_construct: () }', /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.3.14/src/util.rs:91:14
    stack backtrace:
       0:     0x55ed7b47c96d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h23ccc882a731fbd2
       1:     0x55ed7b49ec3c - core::fmt::write::hfa7c8ef1632cb66d
       2:     0x55ed7b477281 - std::io::Write::write_fmt::h25599615a879f3c1
       3:     0x55ed7b47e165 - std::panicking::default_hook::{{closure}}::h4e55e182b98c2bdb
       4:     0x55ed7b47ddd9 - std::panicking::default_hook::haf55aabe5a854e67
       5:     0x55ed7b47e738 - std::panicking::rust_panic_with_hook::h062980c33c10341b
       6:     0x55ed7b47e5e7 - std::panicking::begin_panic_handler::{{closure}}::hb0e308c246d86e22
       7:     0x55ed7b47ce24 - std::sys_common::backtrace::__rust_end_short_backtrace::h1ca03a770cddc17f
       8:     0x55ed7b47e319 - rust_begin_unwind
       9:     0x55ed7a36f033 - core::panicking::panic_fmt::ha831adb2c8e704a1
      10:     0x55ed7a36f123 - core::result::unwrap_failed::ha14b8d7acf8b64a0
      11:     0x55ed7a5db2ca - core::result::Result<T,E>::expect::h164dda76cf95bcd7
                                   at /builddir/build/BUILD/rustc-1.62.0-src/library/core/src/result.rs:1035:23
      12:     0x55ed7a4da4b7 - tracing_subscriber::util::SubscriberInitExt::init::h2e69def373645d45
                                   at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-subscriber-0.3.14/src/util.rs:90:9
      13:     0x55ed7a6a934f - console_subscriber::builder::Builder::init::hee415da29f990fe5
                                   at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/console-subscriber-0.1.6/src/builder.rs:346:9
      14:     0x55ed7a6aa0f3 - console_subscriber::builder::init::h5f5350d624741eda
                                   at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/console-subscriber-0.1.6/src/builder.rs:533:5
      15:     0x55ed7a402702 - permissionless::main::{{closure}}::h94b67aafc2bdcee1
                                   at /mnt/storage/Downloads/chamomile/examples/permissionless.rs:7:5
      16:     0x55ed7a3fe79b - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hb83645c193a2df7d
                                   at /builddir/build/BUILD/rustc-1.62.0-src/library/core/src/future/mod.rs:91:19
      17:     0x55ed7a3f5fbf - <tracing::instrument::Instrumented<T> as core::future::future::Future>::poll::hd2a132a05cd0f5b8
                                   at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-0.1.35/src/instrument.rs:272:9
      18:     0x55ed7a449400 - tokio::park::thread::CachedParkThread::block_on::{{closure}}::h31000afaf1c9072f
                                   at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.20.0/src/park/thread.rs:263:54
      19:     0x55ed7a4a6070 - tokio::coop::with_budget::{{closure}}::hc2d9d351c4239170
                                   at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.20.0/src/coop.rs:102:9
      20:     0x55ed7a4a5a96 - std::thread::local::LocalKey<T>::try_with::he76beafb8d671a29
                                   at /builddir/build/BUILD/rustc-1.62.0-src/library/std/src/thread/local.rs:445:16
      21:     0x55ed7a4a554d - std::thread::local::LocalKey<T>::with::h91e043711161342c
                                   at /builddir/build/BUILD/rustc-1.62.0-src/library/std/src/thread/local.rs:421:9
      22:     0x55ed7a449270 - tokio::coop::with_budget::h3ad72dc3cceae9ea
                                   at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.20.0/src/coop.rs:95:5
      23:     0x55ed7a449270 - tokio::coop::budget::h03a02cae92aed21f
                                   at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.20.0/src/coop.rs:72:5
      24:     0x55ed7a449270 - tokio::park::thread::CachedParkThread::block_on::h874408082e60ddd7
                                   at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.20.0/src/park/thread.rs:263:31
      25:     0x55ed7a46fbd6 - tokio::runtime::enter::Enter::block_on::h4305445dc37b185e
                                   at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.20.0/src/runtime/enter.rs:152:13
      26:     0x55ed7a401db9 - tokio::runtime::thread_pool::ThreadPool::block_on::hccba8273e8ddd709
                                   at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.20.0/src/runtime/thread_pool/mod.rs:90:9
      27:     0x55ed7a36f9b5 - tokio::runtime::Runtime::block_on::ha23298339cc46ea6
                                   at /home/nimda/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.20.0/src/runtime/mod.rs:484:43
      28:     0x55ed7a4c9f82 - permissionless::main::h48a647e330bcd8a8
                                   at /mnt/storage/Downloads/chamomile/examples/permissionless.rs:60:5
      29:     0x55ed7a4bac0b - core::ops::function::FnOnce::call_once::h41fc2f4d7d0022bb
                                   at /builddir/build/BUILD/rustc-1.62.0-src/library/core/src/ops/function.rs:248:5
      30:     0x55ed7a45852e - std::sys_common::backtrace::__rust_begin_short_backtrace::h96402e75acdc44c7
                                   at /builddir/build/BUILD/rustc-1.62.0-src/library/std/src/sys_common/backtrace.rs:122:18
      31:     0x55ed7a405171 - std::rt::lang_start::{{closure}}::h4bbf6843c82df052
                                   at /builddir/build/BUILD/rustc-1.62.0-src/library/std/src/rt.rs:145:18
      32:     0x55ed7b47258e - std::rt::lang_start_internal::ha3452024dbd70b60
      33:     0x55ed7a405140 - std::rt::lang_start::hbb1c9173ec75aec9
                                   at /builddir/build/BUILD/rustc-1.62.0-src/library/std/src/rt.rs:144:17
      34:     0x55ed7a4ca07c - main
      35:     0x7f49eb1ab550 - __libc_start_call_main
      36:     0x7f49eb1ab609 - __libc_start_main_alias_1
      37:     0x55ed7a36f325 - _start
      38:                0x0 - <unknown>
    
    opened by qualterz 2
  • [Question] Protocol and Transport Characteristics

    [Question] Protocol and Transport Characteristics

    I've got a couple of general questions about the chamomile protocol and transports:

    1. What are the requirements for a chamomile transport implementation at the message level. Does it need to make sure that messages are delivered reliably and in-order like TCP or can messages be unordered and unreliably delivered like UDP?

    2. Is the protocol suitable for streaming applications such as network gaming or video conferencing or is it not designed for high-bandwidth, low-latency communication and it would instead be used to find peers and establish a different protocol connection between peers for things like streaming video?

    opened by zicklag 2
  • RFC: QUIC-like UDP transport.

    RFC: QUIC-like UDP transport.

    What ?

    QUIC-like UDP without it's cryptography, because we has our cryptogrpahy protocol.

    Why ?

    we need a udp transport, because many connection will incoming, so tcp socket has limit number, it is better to use UDP.

    How ?

    (WIP)

    opened by sunhuachuang 2
  • Update quinn-proto requirement from 0.8 to 0.9

    Update quinn-proto requirement from 0.8 to 0.9

    Updates the requirements on quinn-proto to permit the latest version.

    Release notes

    Sourced from quinn-proto's releases.

    0.9.0

    We are happy to announce the release of 0.9.0 of Quinn, our pure-Rust implementation of QUIC. This release introduces extensible support for multiple async runtimes, improves Connection API ergonomics, and introduces a variety of new features, performance improvements, and bugfixes.

    Important changes

    • Abstract runtime support (#1364, thanks to @​yu-re-ka)
    • Replace NewConnection struct with Connection methods (#1357)
    • Replace Incoming stream with Endpoint::accept async method (#1426)

    Functional improvements

    • Add additional metrics for lost packets and bytes (#1248, thanks to @​Matthias247)
    • Implement draft-ietf-quic-bit-grease-02 (#1286)
    • Allow adjustment of per-connection concurrent stream limits (#1315)
    • Allow initial maximum UDP payload size to be configured (#1379)
    • Configure receive window per connection (#1386, thanks to @​lijunwangs)
    • Define Connection::closed() helper to await connection termination (#1396)
    • Expose a getter for the close reason (#1424)
    • Accessor for free datagram send buffer space (#1423)

    Performance improvements

    Bug fixes

    • Tolerate wide IP_TOS cmsgs (#1274)
    • Identify zero-length connections by four-tuple (#1306)
    • Retry token fixes (#1332)
    • Fix Linux DF bit setting for IPv6-mapped IPv4 addresses (#1381)
    • Fix build errors so quinn-proto can be used under wasm32-unknown-unknown (#1387, thanks to @​thombles)
    • Disable IP fragmentation on Windows (#1383)
    • Check QUIC bit in short headers (#1404, thanks to @​thekuwayama)
    • Fix stopped streams not issuing ID credit when reset (#1422)

    Other improvements

    • Replace futures-util with optional futures-io dep (#1263)
    • Strip down futures-* dependencies (#1273)
    • Reexport UnknownStream (#1268)
    • Replace Broadcast helper with tokio::sync::Notify (#1264)
    • Rely on rustls to check for ALPN failure (#1258)
    • Use config to reject connections rather than extra state (#1247)
    • Adjust link to quinn crate entry point in docs (#1241, thanks to @​themaxdavitt)
    • Expose RttEstimator interface publicly (#1243, thanks to @​BiagioFesta)
    • Replace fxhash with rustc_hash (#1246)
    • Don't update remote client CIDs gratuitously (#1294)
    • Change overly verbose info span to debug (#1351, thanks @​alessandrod)

    ... (truncated)

    Commits
    • b80baa0 Add --initial-max-udp-payload-size command line option for perf
    • cebfb27 Add --keylog command line option for perf client and server
    • 28a2c80 quinn: bump dependency on tokio to 1.13
    • 57bd764 quinn-udp: bump version to 0.3
    • 4c4da51 Bump version numbers for 0.9 release
    • 00fb347 Move idle Notify handle into endpoint Shared
    • 7d51d2e Remove Incoming stream in favor of Endpoint::accept
    • b885739 Introduce Endpoint::accept method for better ergonomics
    • c630595 Update book for removal of NewConnection
    • feca8ab Accessor for free datagram send buffer space
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • RFC: support multiple transports at same runtime.

    RFC: support multiple transports at same runtime.

    When peers use different transport, and want to connect, the sender must use the receiver's default transport. Example: Alice use tcp as default, Bob use quic as default.

    When Alice wants to connect to Bob, she needs to start a quic connect to Bob, and then they use this quic connection. When Bob wants to connect to Alice, he needs to start a tcp connect to Alice, and then they use this tcp connection.

    Tip: quic is server/client in one socket. quic socket must only start one time. And as runtime transport. (Default is QUIC)

    And when start a new transport (no default), it will use 0:0:0:0:0 to generate a socket by system.

    opened by sunhuachuang 1
  • RFC: Under relay find can directly, changed it.

    RFC: Under relay find can directly, changed it.

    What ?

    when peer stable connections is relay, and then find a directly incoming, and it is this stable connection, change the stable connection to directly.

    Why ?

    Better connection.

    How ?

    When incoming stream to server, server check it is new & check it is stable connection on relay.

    if peer_list.stables.contains(peer_id) && peer_list.stables.get(peer_id).unwrap().is_relay {
        //
    }
    
    
    opened by sunhuachuang 1
  • RFC: Add request/response network state message.

    RFC: Add request/response network state message.

    Why

    When want to know current network state, need a function to get.

    How

    • Add SendMessage::NetworkState
    enum SendMessage {
        ...
        /// Request for return the network current state info.
        /// params is request type, and return channel's sender (async).
        NetworkState(StateRequest, Sender<StateResponse>),
    }
    
    /// Network state info response.
    #[derive(Debug, Clone)]
    pub enum StateRequest {
        Stable,
        DHT,
        Seed,
    }
    
    /// Network state info response.
    #[derive(Debug, Clone)]
    pub enum StateResponse {
        /// response is peer list and peer is relay or directly.
        Stable(Vec<(PeerId, bool)>),
        /// response is peer list.
        DHT(Vec<PeerId>),
        /// response is socket list.
        Seed(Vec<SocketAddr>),
    }
    
    enhancement 
    opened by sunhuachuang 1
  • RFC: message delivery feedback.

    RFC: message delivery feedback.

    Why

    Because p2p network is complex and unstable, so , add delivery feedback for stable connection.

    How

    • use u32 as data's symbol. and only work on stable connection, not DHT.
    • Add new enum type ReceiveMessage::Delivery(u32, bool)
    • Add u32 to ReceiveMessage::StableConnect(u32, ..), ReceiveMessage::StableResult(u32, ..), ReceiveMessage::Data(u32, ..)
    • Add u32 to SendMessage::StableConnect(u32, ..), SendMessage::StableResult(u32, ...), SendMessage::Data(u32, ..)
    enhancement 
    opened by sunhuachuang 1
  • Update secp256k1 requirement from 0.24 to 0.25

    Update secp256k1 requirement from 0.24 to 0.25

    Updates the requirements on secp256k1 to permit the latest version.

    Changelog

    Sourced from secp256k1's changelog.

    0.25.0 - 2022-12-07

    0.24.1 - 2022-10-25

    0.24.0 - 2022-07-20

    0.23.4 - 2022-07-14

    0.23.3 - 2022-06-29

    0.23.2 - 2022-06-27

    0.23.1 - 2022-06-24

    Enable "rand/std_rng" feature when the crate's "rnd-std" feature is enabled.

    0.23.0 - 2022-06-21

    The major change in this version is the increase of the Minimum Supported Rust Version (MSRV) from 1.29 to 1.41.1, this is a big change because it introduces Rust Edition 2018 to the codebase along with all the benefits that brings.

    Breaking changes

    New features/APIs

    ... (truncated)

    Commits

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Update quinn-proto requirement from 0.8 to 0.9

    Update quinn-proto requirement from 0.8 to 0.9

    Updates the requirements on quinn-proto to permit the latest version.

    Release notes

    Sourced from quinn-proto's releases.

    0.9.0

    We are happy to announce the release of 0.9.0 of Quinn, our pure-Rust implementation of QUIC. This release introduces extensible support for multiple async runtimes, improves Connection API ergonomics, and introduces a variety of new features, performance improvements, and bugfixes.

    Important changes

    • Abstract runtime support (#1364, thanks to @​yu-re-ka)
    • Replace NewConnection struct with Connection methods (#1357)
    • Replace Incoming stream with Endpoint::accept async method (#1426)

    Functional improvements

    • Add additional metrics for lost packets and bytes (#1248, thanks to @​Matthias247)
    • Implement draft-ietf-quic-bit-grease-02 (#1286)
    • Allow adjustment of per-connection concurrent stream limits (#1315)
    • Allow initial maximum UDP payload size to be configured (#1379)
    • Configure receive window per connection (#1386, thanks to @​lijunwangs)
    • Define Connection::closed() helper to await connection termination (#1396)
    • Expose a getter for the close reason (#1424)
    • Accessor for free datagram send buffer space (#1423)

    Performance improvements

    Bug fixes

    • Tolerate wide IP_TOS cmsgs (#1274)
    • Identify zero-length connections by four-tuple (#1306)
    • Retry token fixes (#1332)
    • Fix Linux DF bit setting for IPv6-mapped IPv4 addresses (#1381)
    • Fix build errors so quinn-proto can be used under wasm32-unknown-unknown (#1387, thanks to @​thombles)
    • Disable IP fragmentation on Windows (#1383)
    • Check QUIC bit in short headers (#1404, thanks to @​thekuwayama)
    • Fix stopped streams not issuing ID credit when reset (#1422)

    Other improvements

    • Replace futures-util with optional futures-io dep (#1263)
    • Strip down futures-* dependencies (#1273)
    • Reexport UnknownStream (#1268)
    • Replace Broadcast helper with tokio::sync::Notify (#1264)
    • Rely on rustls to check for ALPN failure (#1258)
    • Use config to reject connections rather than extra state (#1247)
    • Adjust link to quinn crate entry point in docs (#1241, thanks to @​themaxdavitt)
    • Expose RttEstimator interface publicly (#1243, thanks to @​BiagioFesta)
    • Replace fxhash with rustc_hash (#1246)
    • Don't update remote client CIDs gratuitously (#1294)
    • Change overly verbose info span to debug (#1351, thanks @​alessandrod)

    ... (truncated)

    Commits
    • b80baa0 Add --initial-max-udp-payload-size command line option for perf
    • cebfb27 Add --keylog command line option for perf client and server
    • 28a2c80 quinn: bump dependency on tokio to 1.13
    • 57bd764 quinn-udp: bump version to 0.3
    • 4c4da51 Bump version numbers for 0.9 release
    • 00fb347 Move idle Notify handle into endpoint Shared
    • 7d51d2e Remove Incoming stream in favor of Endpoint::accept
    • b885739 Introduce Endpoint::accept method for better ergonomics
    • c630595 Update book for removal of NewConnection
    • feca8ab Accessor for free datagram send buffer space
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Update aes-gcm requirement from 0.9 to 0.10

    Update aes-gcm requirement from 0.9 to 0.10

    Updates the requirements on aes-gcm to permit the latest version.

    Commits

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Implement hole punching

    Implement hole punching

    I would like to help implement hole punching for understanding i think we need stun server to know peer public ip and port. Client will send udp packing to server with port and adding it public ip and address to DHT So that others can connect directly to it.

    1)The two peers both open a UDP socket bound to a random local port The two peers both contact a server on the internet. This server responds and tells them what IP and port their packet was received from. Since the server is on the Internet the IP/port seen by the server is the external IP and port 2)The two peers exchange information about the external IPs and ports through some mechanism. The two peers start trying to send UDP traffic to each other. 3)Hopefully the external IP and port used by the NAT for the traffic to the server are the same as the external IP and port used for the traffic sent towards the other peer. So once both peers have sent packets out through their NATs the incoming packets match the mappings and peer to peer communication is established.

    Note: This strategy will work reliablly with full cone, restricted cone or restricted port cone NATs. It will work most of the time with port-preservative symmetric NATs. It will not work with randomising symmetric NATs.

    Sun can you provide some guidance for this ???

    opened by DAOCUONG 6
  • RFC: Use the group to deal with the same PeerId in the network

    RFC: Use the group to deal with the same PeerId in the network

    In the previous logic, when two same PeerID appear in the network, the node will be automatically replaced with the new peerID. This logic is based on the fact that the nodes are automatically generated randomly, but now the start_with_key interface is added, and the nodes are no longer random. May be repeated. So there needs to be reasonable logic to handle this.

    When a common node receives the same PeerId, it will check whether the peer is eq. If the peer is eq completely, will only update SessionKey. If it not, it will not be replaced, and the existing node with the same PeerId will be sent to the request node.

    When the node receives the same PeerId as self, it will check whether the Peer is eq completely with self. If it is eq, it is considered to be itself. If it not, it is considered to be other nodes in the same group, and is included in the management of the same group, and sends a special message to the upper-layer application.

    AND. When a node receives a message, It will broadcast this message to all node in this group.

    opened by sunhuachuang 0
  • Possibility of WASM Support?

    Possibility of WASM Support?

    Hey there, I just found this and I was wondering what your thoughts on the possibility of WASM support might be. A quick check and attempt at compiling leads me to think that the only thing stopping it so far is its dependency on async-io from the smol crate.

    For web we might be able to get away without smol by using wasm-bindgen-futures and I recently ported async_lock to work on web ( it just needed to remove the dependency on std::instant ) so we might be able to get async_channel to work as well ( or it will just work, I haven't tried it.

    At that point you just have to worry about the transport. You would have to use websockets I think, and peer to peer doesn't really work on web without a signalling server we would have to take that into account to.

    Anyway, I literally just found this, but I thought it looked neat and I've wondered about having a Rust library that I could on desktop native and in web to provide peer-to-peer DApps for a while so I thought I'd ask. :)

    opened by zicklag 7
  • RFC: DHT update with weight algorithm.

    RFC: DHT update with weight algorithm.

    Now Kademlia use binary distance to check if bucket is full, remove far node. In our project, if the node is to as relay, it maybe not update easily, need has a weight. weight maybe include binary distance, relay's info, online time and physical location.

    enhancement 
    opened by sunhuachuang 0
  • RFC: Robust stable connection.

    RFC: Robust stable connection.

    Now stable has two connect type.

    • Direct (EndpointStream) - listen the transport's stream. like Tcpstream.
    • Relay (SessionSend) - use other session's channel address as endpoint.

    If listen, need handle two way.

    • build stable connection table, add other connect type and keep stable connect the remote peer. (by relay).
    • If current connection is lost, use other channel to it. and then rebuild stable connection table.

    If lost connection.

    • If now is Directly, reconnect. (if not ok, change to Relay way.).
    • If now is Relay, if relay session is closed, choose other closest peer in DHT and send Ping to check.
    enhancement 
    opened by sunhuachuang 0
Releases(v0.8.0)
  • v0.8.0(Feb 12, 2022)

    Breaking changes.

    1. new PeerID (from 32 to 20 bytes, and generate from double hash PublicKey (Sha3_256 + Ripemd160) )
    2. Key info move to types
    3. Update SessionKey validation
    Source code(tar.gz)
    Source code(zip)
  • v0.7.0(Dec 15, 2021)

    Breaking changes.

    • Move Peer to chamomile_types crate.
    • MessageType when Connect ConnectResult, use Peer replace PeerId, for more information.
    • Support new RFC (issue #20). If Alice use QUIC, Bob use TCP, they can still connect and communicate with each other.
    Source code(tar.gz)
    Source code(zip)
  • v0.6.0(Sep 3, 2021)

Owner
CympleTech
Own data security. Your place, your rules.
CympleTech
A fast, stable, efficient, and lightweight intranet penetration, port forwarding tool supports multiple connections, cascading proxy, and transmission encryption

A fast, stable, efficient, and lightweight intranet penetration, port forwarding tool supports multiple connections, cascading proxy, and transmission encryption

editso 1.3k Dec 30, 2022
Reliable p2p network connections in Rust with NAT traversal

Reliable p2p network connections in Rust with NAT traversal. One of the most needed libraries for any server-less / decentralised projects

MaidSafe-Archive 948 Dec 20, 2022
Reliable p2p network connections in Rust with NAT traversal

Reliable p2p network connections in Rust with NAT traversal. One of the most needed libraries for any server-less, decentralised project.

MaidSafe-Archive 948 Dec 20, 2022
A generic Rust based Bigtable connection library implemented using gRPC

A generic Rust based Bigtable connection library refactored out the solana mono-repo so that can be shared for different applications.

Lijun Wang 3 Sep 25, 2022
Simple SSH, TELNET connection manager written in rust

gcoma gcoma or Geri's Connection Manager is a small project, that I started to learn rust. The goal of this project is to create a MTPuTTY like cli ap

Bak Gergely János 2 Sep 30, 2022
A modern, simple TCP tunnel in Rust that exposes local ports to a remote server, bypassing standard NAT connection firewalls

bore A modern, simple TCP tunnel in Rust that exposes local ports to a remote server, bypassing standard NAT connection firewalls. That's all it does:

Eric Zhang 6.2k Dec 31, 2022
A multi-connection TCP reverse proxy server and client.

tprox A multi-connection TCP reverse proxy. The tprox server is able to proxy multiple incoming connections to the tprox client over a single TCP conn

Mohammed Ajmal Siddiqui 4 Sep 21, 2022
wireguard tool to manage / generate configuration. Maintain one yaml configuration file to quickly build wireguard network.

wgx wireguard tool to manage / generate configuration. Maintain one yaml configuration file to quickly build wireguard network. Usage wgx --h USAGE:

yinheli 6 Nov 3, 2022
Docker containers on a synthetic network. Run applications in a context that lets you manipulate their network conditions.

Synthetic Network Docker containers on a synthetic network. Run applications in a context that lets you manipulate their network conditions. Dependenc

Daily 58 Dec 15, 2022
Drpc-Correct, high performance, robust, easy use Remote invocation framework

Drpc - Correct, high performance, robust, easy use Remote invocation framework

darkrpc 30 Dec 17, 2022
Bevy plugin for the GGRS P2P rollback networking library.

Bevy_GGRS Bevy plugin for the ?? GGRS P2P rollback networking library. The plugin creates a custom stage with a separate schedule, which handles corre

Georg Friedrich Schuppe 120 Jan 6, 2023
A fast and stable reverse proxy for NAT traversal, written in Rust

rathole A fast and stable reverse proxy for NAT traversal, written in Rust rathole, like frp, can help to expose the service on the device behind the

Yujia Qiao 4.6k Dec 30, 2022
a decentralized p2p chatroom app built for practice

Yosup is an app made for the purpose of learning libp2p technology, asynchronous rust, ways to incorporate a single protocol over multiple interfaces, and cryptography.

Louis Birla 2 Jan 14, 2022
Prototype for Koru, a parametrized p2p monetary system.Checkout

Koru About This is a prototype for Koru, a parametrized p2p monetary system consisting of: Mutual credit Voting and decision making platform (for econ

Koru 6 Oct 9, 2022
P2P File Transfer

P2P File Transfer Overview This is a small project to help solve a problem that should've been solved by now: file transfer. For in-person file transf

Saksham Mittal 2 Dec 15, 2022
A proof of concept implementation of RTSP over Dahua P2P protocol.

RTSP Streaming with Dahua P2P Protocol Implementation This is a proof of concept implementation of RTSP over Dahua P2P protocol. It works with Dahua a

null 6 Dec 21, 2023
Bioyino is a distributed statsd-protocol server with carbon backend.

Bioyino The StatsD server written in Rust Description Bioyino is a distributed statsd-protocol server with carbon backend. Features all basic metric t

avito.tech 206 Dec 13, 2022
The open source distributed web search engine that searches by meaning.

DawnSearch DawnSearch is an open source distributed web search engine that searches by meaning. It uses semantic search (searching on meaning), using

DawnSearch 4 Aug 8, 2023
A library-first, lightweight, high-performance, cloud-native supported API gateway🪐 by RUST

Preview version, will not guarantee the stability of the API! Do NOT use in production environment! A library-first, lightweight, high-performance, cl

Ideal World 4 May 7, 2023