nxtquic-api 0.1.1

High-level async API for NxtQuic
Documentation
//! # NxtQuic Async API
//!
//! High-level async/await API for the NxtQuic QUIC transport library.
//! Provides ergonomic `Endpoint`, `Connection`, `SendStream`, and `RecvStream`
//! types built on top of the I/O-free `nxtquic-proto` core.
//!
//! This crate will be fully implemented in Phase 4 of the NxtQuic project.

#![forbid(unsafe_code)]
#![warn(missing_docs)]

pub mod connection;
pub mod endpoint;
pub mod runtime;
pub mod stream;

pub use connection::Connection;
pub use endpoint::{ClientConfig, Endpoint, EndpointConfig, ServerConfig, Connecting, Incoming};
pub use stream::{RecvStream, SendStream};

#[cfg(test)]
mod tests {
    use super::*;
    use std::net::SocketAddr;

    #[tokio::test]
    async fn test_loopback_connection_establishment() {
        let server_addr: SocketAddr = "127.0.0.1:0".parse().unwrap();
        let _server_endpoint = Endpoint::bind(server_addr).await.unwrap();

        let client_endpoint = Endpoint::bind("127.0.0.1:0".parse().unwrap()).await.unwrap();
        let connecting = client_endpoint.connect(server_addr, "localhost").await.unwrap();
        
        let _client_conn = connecting.await_connection().await.unwrap();
    }
}