rust-high-performance-networking

Crates.iorust-high-performance-networking
lib.rsrust-high-performance-networking
version0.2.2
created_at2026-01-17 08:21:08.490093+00
updated_at2026-01-17 08:21:08.490093+00
descriptionHigh-performance async TCP/UDP/HTTP networking library built on Tokio
homepage
repositoryhttps://github.com/xeyronoxz/rust-high-performance-networking
max_upload_size
id2050133
size63,158
Prakhar Gangwar (xeyronoxz)

documentation

README

Rust High-Performance Networking Crate

A high-performance networking library in Rust, providing async TCP/UDP echo servers and HTTP echo server using Tokio and Hyper. Optimized for low-latency I/O operations.

By xeyronoxz

Features

  • TCP Echo Server: Asynchronous TCP server that echoes back received data with connection limits and graceful shutdown.
  • UDP Echo Server: Asynchronous UDP server for echo functionality with graceful shutdown.
  • HTTP Echo Server: HTTP server that echoes request bodies with connection limits and graceful shutdown.
  • High Performance: Built with Tokio for async I/O, zero-copy buffers with Bytes, backpressure handling.
  • Benchmarks: Includes Criterion benchmarks for performance testing.
  • Production Ready: Graceful shutdown, connection pooling, error handling, structured logging.

Installation

Add this to your Cargo.toml:

[dependencies]
rust-high-performance-networking = "0.2.2"

Usage

TCP Echo Server

use rust_high_performance_networking::start_echo_server;
use tokio::sync::broadcast;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
    let (shutdown_tx, shutdown_rx) = broadcast::channel(1);
    start_echo_server("127.0.0.1:8080", 100, shutdown_rx).await?;
    // To shutdown: shutdown_tx.send(()).unwrap();
    Ok(())
}

UDP Echo Server

use rust_high_performance_networking::start_udp_echo_server;
use tokio::sync::broadcast;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
    let (shutdown_tx, shutdown_rx) = broadcast::channel(1);
    start_udp_echo_server("127.0.0.1:8081", shutdown_rx).await?;
    Ok(())
}

HTTP Echo Server

use rust_high_performance_networking::start_http_echo_server;
use tokio::sync::broadcast;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
    let (shutdown_tx, shutdown_rx) = broadcast::channel(1);
    start_http_echo_server("127.0.0.1:8082", 100, shutdown_rx).await?;
    Ok(())
}

API Documentation

Run cargo doc --open to view detailed API docs.

Benchmarks

Run benchmarks with:

cargo bench

Testing

Run tests with:

cargo test

License

MIT License - see LICENSE file.

Contributing

Contributions welcome! Please submit issues and pull requests.

Commit count: 7

cargo fmt