• Stars
    star
    359
  • Rank 114,707 (Top 3 %)
  • Language
    Rust
  • License
    BSD 3-Clause "New...
  • Created about 5 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

peer-to-peer communications library for Rust based on QUIC protocol

qp2p

Crate Documentation
Documentation
MaidSafe website SAFE Dev Forum SAFE Network Forum

Overview

This library provides an API to simplify common tasks when creating P2P networks, including:

  • Establishing encrypted, uni- and bidirectional connections (using QUIC with TLS 1.3).
  • Connection pooling, for reusing already opened connections.
  • Fault-tolerance, including retries and racing connections against sets of peers.
  • Sending discrete messages (using QUIC streams as 'framing').

Features

QUIC

There are several informative posts describing both QUIC and TLS 1.3:

These are highly recommended to be able to better understand this library, in particular the Cloudflare blog posts (10 minute read).

Encryption of connections

QUIC provides connection security via the use of TLS 1.3. Currently, self-signed certificates are used to encrypt connections, but this provides no authentication.

In the future, we would like to support authentication via certificate authorities and pre-agreed certificates. This should satisfy the requirements of many P2P networks, whether they trust any clearnet certificate authority (which may be a centralised attack source) or whether they pass the identity management up to a different layer to validate identities and simply use qp2p as a secured network in terms of encrypted connections.

Connection pooling

Although QUIC connections are relatively cheap to establish (e.g. compared to TCP connections), there is still some overhead. To minimise this overhead, all opened connections are pooled and reused based on their target socket address.

Fault tolerance

APIs are available to connect to any peer from a list of peers. Connections are established concurrently, and the first to succeed is kept, while the rest are discarded. This allows connecting to any of a set of equivalent peers, finding a still-reachable peer in a set of previously known peers, etc.

Messaging

QUIC is a streaming protocol, without an explicit model for discrete messages. However, QUIC connections can multiplex an arbitrary number of streams, which are cheap to construct and dispose of. This library uses streams as a message framing mechanism, sending or receiving a single message per stream.

QUIC supports both unidirectional and bidirectional streams, and both are exposed through this library.

  • Unidirectional streams should typically be preferred for peer-to-peer communication. This requires peers to have external connectivity, which is generally better for fault tolerance (e.g. contact sharing, reconnection).

  • Bidirectional streams should be preferred for client-server communication. This does not require external connectivity, so clients can still communicate from behind firewalls/gateways (such as household routers).

License

This SAFE Network library is dual-licensed under the Modified BSD (LICENSE-BSD https://opensource.org/licenses/BSD-3-Clause) or the MIT license (LICENSE-MIT http://opensource.org/licenses/MIT) at your option.

Contributing

Want to contribute? Great πŸŽ‰

There are many ways to give back to the project, whether it be writing new code, fixing bugs, or just reporting errors. All forms of contributions are encouraged!

For instructions on how to contribute, see our Guide to contributing.

More Repositories

1

sn_routing

Routing - specialised storage DHT
Rust
276
star
2

sn_browser

Safe Network Browser Application
TypeScript
201
star
3

crdt_tree

Rust
117
star
4

temp_safe_network

The Safe Network. A libp2p backed data and transfer network
Rust
109
star
5

self_encryption

file self encryptor
Rust
107
star
6

lru_time_cache

LRU cache settable via size or time to live
Rust
100
star
7

rfcs

Request for Comment (RFC) papers and discussions on Project SAFE core libraries and APIs
Rust
97
star
8

rust_sodium

This crate is no longer maintained. Looking for maintainers.
Rust
78
star
9

sn

The Safe Network Core. API message definitions, routing and nodes, client core api.
Rust
68
star
10

safe_network

Rust
51
star
11

sn_data_types

Safe Network Data Types
Rust
24
star
12

maidsafe-utilities

Utility functions
Rust
22
star
13

bls_dkg

Implementation of a BLS DKG mechanism, requires signing key, encryption key and SocketAddr of participants
Rust
20
star
14

blsttc

poanetwork/threshold_crypto using supranational/blst for sign+verify
Rust
18
star
15

sn_nodejs

Rust
18
star
16

safenetwork.tech

JavaScript
16
star
17

QA

JavaScript
15
star
18

sn_launch_tool

A cross platform tool to easily launch a SAFE Network test section from home
Rust
12
star
19

sn_transfers

Implementation of Transfers in the SAFE Network.
Rust
11
star
20

xor_name

Small library. XorName is an array that is useful for calculations in DHT etc.
Rust
11
star
21

safe-web-id-manager-js

JavaScript
10
star
22

maidsafe.net

Repository for maidsafe.net company website
CSS
10
star
23

qjsonrpc

Provides the implementation of JSON-RPC over QUIC, which is required by the Authenticator daemon communication protocol.
Rust
10
star
24

sn_dbc

Safe Network DBCs
Rust
10
star
25

brb

Rust
9
star
26

dev-website

SAFE Network Dev Website source.
JavaScript
9
star
27

safe-patter-js

JavaScript
8
star
28

sn_messaging

Rust
8
star
29

sn_testnet_tool

Just
7
star
30

sn_app_mobile

Safe Network App for mobile (Android & iOS)
C#
7
star
31

sn_entropy_check

Rust
6
star
32

sn_fs

Rust
5
star
33

sn_cli

A Rust application which implements a CLI (Command Line Interface) for the Safe Network.
Rust
5
star
34

routing_model

Documentation of the control and message flows in Routing, and tests for validating these.
Rust
5
star
35

Whitepapers

MaidSafe Whitepapers
TeX
4
star
36

brb_membership

Rust
4
star
37

brb_node_qp2p

Rust
4
star
38

sn_authd

Rust
4
star
39

sn_sdkg

Synchronous Distributed Key Generation
Rust
4
star
40

sn_consensus

Rust
4
star
41

pr_size_checker

A GitHub Action which checks the number of additions and deletions made in each submitted PR, adding them together to come up with a total lines changed value, then checking whether this value exceeds the default or set max_lines_changed value. If it does exceed then the CI job will exit with code 1, i.e. fail.
4
star
42

sn_diagrams

Diagrams of the Safe Network codebase structure
HTML
3
star
43

brb_dt_orswot

Rust
3
star
44

brb_dt_at2

Rust
3
star
45

bls_ringct

Rust
3
star
46

bls_signature_aggregator

A Generic BLS Signature Accumulator for SAFE Network
Rust
3
star
47

brb_dt_tree

Rust
3
star
48

rust-version-bump-branch-creator

Bump your rust repo's version automatically, using conventional commits to generate a changelog and determine the correct new version.
JavaScript
3
star
49

sn_url

Rust
2
star
50

secured_linked_list

Rust
2
star
51

resource_proof

A 'proof' of bandwidth, cpu and storage for nodes in a decentralised network
Rust
2
star
52

bls_bulletproofs

Rust
1
star
53

blog-redirection

HTML
1
star
54

sn_testnet_action

1
star
55

safeup

Install and update safe-related components
Rust
1
star
56

cargo-nextest

Github Action for performing a test run using Nextest
1
star
57

sn-local-testnet-action

Github Action for administering local testnets
1
star