{"id":15646056,"url":"https://github.com/ljedrz/pea2pea","last_synced_at":"2025-04-07T16:17:48.162Z","repository":{"id":37210256,"uuid":"322916042","full_name":"ljedrz/pea2pea","owner":"ljedrz","description":"A simple, low-level, and customizable implementation of a TCP P2P node.","archived":false,"fork":false,"pushed_at":"2025-03-01T16:07:41.000Z","size":1082,"stargazers_count":51,"open_issues_count":0,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-31T15:17:57.976Z","etag":null,"topics":["asynchronous","p2p","peer-to-peer","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ljedrz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-19T18:48:56.000Z","updated_at":"2025-03-30T01:17:33.000Z","dependencies_parsed_at":"2024-10-22T22:36:30.396Z","dependency_job_id":"cabbf32c-c34d-428d-93a1-5d331b0c47f7","html_url":"https://github.com/ljedrz/pea2pea","commit_stats":{"total_commits":708,"total_committers":4,"mean_commits":177.0,"dds":0.005649717514124242,"last_synced_commit":"991783f46b8cd8f7ecb9f774b63e8eb7decff11f"},"previous_names":[],"tags_count":67,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljedrz%2Fpea2pea","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljedrz%2Fpea2pea/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljedrz%2Fpea2pea/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljedrz%2Fpea2pea/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ljedrz","download_url":"https://codeload.github.com/ljedrz/pea2pea/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247685628,"owners_count":20979085,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asynchronous","p2p","peer-to-peer","rust"],"created_at":"2024-10-03T12:11:11.581Z","updated_at":"2025-04-07T16:17:48.138Z","avatar_url":"https://github.com/ljedrz.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pea2pea\n[![crates.io](https://img.shields.io/crates/v/pea2pea)](https://crates.io/crates/pea2pea)\n[![docs.rs](https://docs.rs/pea2pea/badge.svg)](https://docs.rs/pea2pea)\n[![dependencies](https://deps.rs/crate/pea2pea/latest/status.svg)](https://deps.rs/crate/pea2pea)\n[![actively developed](https://img.shields.io/badge/maintenance-actively--developed-brightgreen.svg)](https://gist.github.com/cheerfulstoic/d107229326a01ff0f333a1d3476e068d)\n[![issues](https://img.shields.io/github/issues-raw/ljedrz/pea2pea)](https://github.com/ljedrz/pea2pea/issues)\n\n**pea2pea** is a simple, low-level, and customizable implementation of a TCP P2P node.\n\nThe core library only provides the most basic functionalities like starting, ending and maintaining connections; the rest is up to a few\nlow-level, opt-in [protocols](https://docs.rs/pea2pea/latest/pea2pea/protocols/index.html):\n- [`Handshake`](https://docs.rs/pea2pea/latest/pea2pea/protocols/trait.Handshake.html) requires connections to adhere to the given handshake logic before anything else can be done with them\n- [`Reading`](https://docs.rs/pea2pea/latest/pea2pea/protocols/trait.Reading.html) enables the node to receive messages based on the user-supplied [Decoder](https://docs.rs/tokio-util/latest/tokio_util/codec/trait.Decoder.html)\n- [`Writing`](https://docs.rs/pea2pea/latest/pea2pea/protocols/trait.Writing.html) enables the node to send messages based on the user-supplied [Encoder](https://docs.rs/tokio-util/latest/tokio_util/codec/trait.Encoder.html)\n- [`OnDisconnect`](https://docs.rs/pea2pea/latest/pea2pea/protocols/trait.OnDisconnect.html) makes the node perform specified actions whenever a connection with a peer is severed\n- [`OnConnect`](https://docs.rs/pea2pea/latest/pea2pea/protocols/trait.OnConnect.html) makes the node perform specified actions whenever a connection with a peer is fully established (post-handshake)\n\n## goals\n- small, simple, non-framework codebase: the entire library is ~1k LOC and there are few dependencies\n- ease of use: few objects and traits, no \"turboeels\" or generics/references that would force all parent objects to adapt\n- correctness: builds with stable Rust, there is no `unsafe` code, there's more code in `tests` than in the actual library\n- low-level: the user has full control over all connections and every byte sent or received\n- good performance: over 10GB/s in favorable scenarios, small memory footprint\n\n## how to use it\n1. define a clonable struct containing a [`Node`](https://docs.rs/pea2pea/latest/pea2pea/struct.Node.html) and any extra state you'd like to carry alongside it\n2. implement the trivial [`Pea2Pea`](https://docs.rs/pea2pea/latest/pea2pea/trait.Pea2Pea.html) trait for it\n3. make it implement any/all of the [protocols](https://docs.rs/pea2pea/latest/pea2pea/protocols/index.html)\n4. create that struct (or as many of them as you like)\n5. enable the protocols you'd like them to utilize\n\nThat's it!\n\n## [examples](https://github.com/ljedrz/pea2pea/tree/master/examples)\n\n- including [noise](https://noiseprotocol.org/noise.html) encryption, simple interop with [`libp2p`](https://crates.io/crates/libp2p), or [TLS](https://en.wikipedia.org/wiki/Transport_Layer_Security) connections\n\n## status\n- all the desired functionalities are complete\n- the crate follows [semver](https://semver.org/), and some API breakage is still possible before `1.0`\n- the project is actively developed, with all changes being recorded in the [CHANGELOG](https://github.com/ljedrz/pea2pea/blob/master/CHANGELOG.md)\n- some of the desired features that are not yet available in Rust include [associated type defaults](https://github.com/rust-lang/rust/issues/29661)\n- the project aims to always build with the current stable Rust compiler; legacy version support is not a goal, but they might also work\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fljedrz%2Fpea2pea","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fljedrz%2Fpea2pea","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fljedrz%2Fpea2pea/lists"}