Skip to content
This repository has been archived by the owner on Apr 25, 2022. It is now read-only.
/ tokio-utp Public archive

A μTP implementation for Tokio

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

Distributed-EPFL/tokio-utp

Repository files navigation

rust-utp

Crate Version Build Status Windows Build Status codecov

An async 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).

Stability

This crate is experimental and contains many bugs. We strongly advice against using it in production environments. Contributions and fixes are welcome :)

Usage

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

[dependencies]
async-utp = "*"

Examples

The simplest example program would be:

use async_utp::UtpStream;
use tokio::task;
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, driver) = UtpStream::connect(addr).await.expect("Error connecting to remote peer");
    
    task::spawn(driver);

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

    // Close the stream
    stream.close().await.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

  • congestion control
  • proper connection closing
    • handle both RST and FIN
    • send FIN on close
    • automatically send FIN on drop if not already closed
  • sending RST on mismatch
  • setters and getters that hide header field endianness conversion
  • SACK extension
  • handle packet loss
    • send triple-ACK to re-request lost packet (fast resend request)
    • rewind send window and resend in reply to triple-ACK (fast resend)
    • resend packet on ACK timeout
  • stream interface
  • handle unordered packets
  • duplicate packet handling
  • listener abstraction
  • incoming connections iterator
  • 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.

About

A μTP implementation for Tokio

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages