{"id":13439903,"url":"https://github.com/meqif/rust-utp","last_synced_at":"2025-03-20T09:30:59.751Z","repository":{"id":18896779,"uuid":"22114915","full_name":"meqif/rust-utp","owner":"meqif","description":"A µTP (Micro/uTorrent Transport Library) library implemented in Rust","archived":true,"fork":false,"pushed_at":"2021-05-29T10:59:36.000Z","size":7395,"stargazers_count":136,"open_issues_count":7,"forks_count":29,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-03-10T03:04:23.612Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/meqif.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-22T18:02:02.000Z","updated_at":"2024-09-16T16:29:34.000Z","dependencies_parsed_at":"2022-09-13T02:31:45.019Z","dependency_job_id":null,"html_url":"https://github.com/meqif/rust-utp","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meqif%2Frust-utp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meqif%2Frust-utp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meqif%2Frust-utp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meqif%2Frust-utp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meqif","download_url":"https://codeload.github.com/meqif/rust-utp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244585687,"owners_count":20476777,"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":[],"created_at":"2024-07-31T03:01:18.055Z","updated_at":"2025-03-20T09:30:59.365Z","avatar_url":"https://github.com/meqif.png","language":"Rust","funding_links":[],"categories":["Libraries","库","Rust","库 Libraries"],"sub_categories":["Network programming","网络编程","网络编程 Network programming"],"readme":"# rust-utp\n\n[![Crate Version](https://img.shields.io/crates/v/utp.svg?style=flat)](https://crates.io/crates/utp)\n[![Build Status](https://img.shields.io/travis/meqif/rust-utp.svg?style=flat)](http://travis-ci.org/meqif/rust-utp)\n[![Windows Build Status](https://ci.appveyor.com/api/projects/status/q38b38fendqat8o6?svg=true)](https://ci.appveyor.com/project/meqif/rust-utp)\n[![codecov](https://codecov.io/gh/meqif/rust-utp/branch/master/graph/badge.svg)](https://codecov.io/gh/meqif/rust-utp)\n[![Dependency Status](https://dependencyci.com/github/meqif/rust-utp/badge)](https://dependencyci.com/github/meqif/rust-utp)\n![Maintenance: experimental](https://img.shields.io/badge/maintenance-experimental-red.svg)\n\nA [Micro Transport Protocol](http://www.bittorrent.org/beps/bep_0029.html)\nlibrary implemented in Rust.\n\n[API documentation](http://meqif.github.io/rust-utp/)\n\n## Overview\n\nThe Micro Transport Protocol is a reliable transport protocol built over\nUDP. Its congestion control algorithm is\n[LEDBAT](http://tools.ietf.org/html/rfc6817), which tries to use as much unused\nbandwidth as it can but readily yields to competing flows, making it useful for\nbulk transfers without introducing congestion in the network.\n\nThe current implementation is somewhat incomplete, lacking a complete implementation of congestion\ncontrol. However, it does support packet loss detection (except by timeout) the\nSelective Acknowledgment extension, handles unordered and duplicate packets and\npresents a stream interface (`UtpStream`).\n\n## Usage\n\nTo use `utp`, add this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nutp = \"*\"\n```\n\nThen, import it in your crate root or wherever you need it:\n\n```rust\nextern crate utp;\n```\n\n## Examples\n\nThe simplest example program would be:\n\n```rust\nextern crate utp;\n\nuse utp::UtpStream;\nuse std::io::Write;\n\nfn main() {\n    // Connect to an hypothetical local server running on port 8080\n    let addr = \"127.0.0.1:8080\";\n    let mut stream = UtpStream::connect(addr).expect(\"Error connecting to remote peer\");\n\n    // Send a string\n    stream.write(\"Hi there!\".as_bytes()).expect(\"Write failed\");\n\n    // Close the stream\n    stream.close().expect(\"Error closing connection\");\n}\n```\n\nCheck out the files under the \"examples\" directory for more example programs, or run them with `cargo run --example \u003cexample_name\u003e`.\n\n## Roadmap\n\n- [x] congestion control\n- [x] proper connection closing\n    - [x] handle both RST and FIN\n    - [x] send FIN on close\n    - [x] automatically send FIN on `drop` if not already closed\n- [x] sending RST on mismatch\n- [x] setters and getters that hide header field endianness conversion\n- [x] SACK extension\n- [x] handle packet loss\n    - [x] send triple-ACK to re-request lost packet (fast resend request)\n    - [x] rewind send window and resend in reply to triple-ACK (fast resend)\n    - [x] resend packet on ACK timeout\n- [x] stream interface\n- [x] handle unordered packets\n- [x] duplicate packet handling\n- [x] listener abstraction\n- [x] incoming connections iterator\n- [x] time out connection after too many retransmissions\n- [ ] path MTU discovery\n\n## License\n\nThis library is distributed under similar terms to Rust: dual licensed under the MIT license and the Apache license (version 2.0).\n\nSee LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeqif%2Frust-utp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeqif%2Frust-utp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeqif%2Frust-utp/lists"}