GitXplorerGitXplorer
m

rust-utp

public
136 stars
29 forks
7 issues

Commits

List of commits on branch main.
Unverified
aad6257176896313cb2f8ec40fa6c80e9cf9b3ea

Document maintenance status

mmeqif committed 4 years ago
Verified
95384ff39d17501e71e38c4142ba951931166eef

Merge pull request #32 from bltavares/2018-edition

mmeqif committed 4 years ago
Unverified
3e8b9ea20a040692999394284d0ebb9c954dd6be

Fix clippy

bbltavares committed 4 years ago
Unverified
54b87a4ab7bfebb507251263fbd0c4ac20141fb7

Migrate to 2018 edition

bbltavares committed 4 years ago
Unverified
1720ff86a806a50664c4313980c8dd7662081e15

cargo fmt

bbltavares committed 4 years ago
Unverified
7cf3ab7f61f8b3003cb5cddc9b9cc178de8fedd5

Update dependencies to latest versions

bbltavares committed 4 years ago

README

The README file for this repository.

rust-utp

Crate Version Build Status Windows Build Status codecov Dependency Status Maintenance: experimental

A Micro Transport Protocol library implemented in Rust.

API documentation

Overview

The Micro Transport Protocol is a reliable transport protocol built over UDP. Its congestion control algorithm is LEDBAT, which tries to use as much unused bandwidth as it can but readily yields to competing flows, making it useful for bulk transfers without introducing congestion in the network.

The current implementation is somewhat incomplete, lacking a complete implementation of congestion control. However, it does support packet loss detection (except by timeout) the Selective Acknowledgment extension, handles unordered and duplicate packets and presents a stream interface (UtpStream).

Usage

To use utp, add this to your Cargo.toml:

[dependencies]
utp = "*"

Then, import it in your crate root or wherever you need it:

extern crate utp;

Examples

The simplest example program would be:

extern crate utp;

use utp::UtpStream;
use std::io::Write;

fn main() {
    // Connect to an hypothetical local server running on port 8080
    let addr = "127.0.0.1:8080";
    let mut stream = UtpStream::connect(addr).expect("Error connecting to remote peer");

    // Send a string
    stream.write("Hi there!".as_bytes()).expect("Write failed");

    // Close the stream
    stream.close().expect("Error closing connection");
}

Check out the files under the "examples" directory for more example programs, or run them with cargo run --example <example_name>.

Roadmap

  • [x] congestion control
  • [x] proper connection closing
    • [x] handle both RST and FIN
    • [x] send FIN on close
    • [x] automatically send FIN on drop if not already closed
  • [x] sending RST on mismatch
  • [x] setters and getters that hide header field endianness conversion
  • [x] SACK extension
  • [x] handle packet loss
    • [x] send triple-ACK to re-request lost packet (fast resend request)
    • [x] rewind send window and resend in reply to triple-ACK (fast resend)
    • [x] resend packet on ACK timeout
  • [x] stream interface
  • [x] handle unordered packets
  • [x] duplicate packet handling
  • [x] listener abstraction
  • [x] incoming connections iterator
  • [x] time out connection after too many retransmissions
  • [ ] path MTU discovery

License

This library is distributed under similar terms to Rust: dual licensed under the MIT license and the Apache license (version 2.0).

See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.