Skip to main content

hyperlane_core/
lib.rs

1//! hyperlane-core
2//!
3//! A lightweight, high-performance, and cross-platform Rust
4//! HTTP server library built on Tokio. It simplifies modern
5//! web service development by providing built-in support
6//! for middleware, WebSocket, Server-Sent Events (SSE),
7//! and raw TCP communication. With a unified and ergonomic
8//! API across Windows, Linux, and MacOS, it enables developers
9//! to build robust, scalable, and event-driven network
10//! applications with minimal overhead and maximum flexibility.
11
12mod config;
13mod context;
14mod error;
15mod hook;
16mod listener;
17mod protocol;
18mod route;
19mod server;
20#[cfg(test)]
21#[path = "../tests/mod.rs"]
22mod tests;
23mod tls;
24
25pub use {config::*, context::*, error::*, hook::*, route::*, server::*};
26
27pub use {http_type::*, inventory};
28
29pub(crate) use {listener::*, protocol::*, tls::*};
30
31use std::{
32    any::Any,
33    cell::{RefCell, RefMut},
34    cmp::Ordering,
35    collections::HashSet,
36    future::{Future, poll_fn},
37    hash::{Hash, Hasher},
38    io::{self, Write, stderr, stdout},
39    mem,
40    net::{AddrParseError, SocketAddr},
41    num::ParseIntError,
42    panic::AssertUnwindSafe,
43    pin::Pin,
44    ptr,
45    str::{Split, SplitWhitespace, Utf8Error, from_utf8},
46    sync::Arc,
47    task::{self, Poll},
48    time::Duration,
49};
50
51use {
52    bytes::Bytes,
53    futures::FutureExt,
54    h3::error::Code,
55    inventory::collect,
56    lombok_macros::*,
57    quinn::{self, Endpoint, Incoming, VarInt},
58    regex::Regex,
59    rustls::pki_types::{
60        CertificateDer, PrivateKeyDer,
61        pem::{self, PemObject},
62    },
63    serde::{Deserialize, Serialize},
64    tokio::{
65        io::{AsyncRead, AsyncWrite, AsyncWriteExt, ReadBuf},
66        join,
67        net::{TcpListener, TcpStream},
68        spawn,
69        sync::watch::{Receiver, Sender, channel},
70        task::JoinHandle,
71        time::timeout,
72    },
73    tokio_rustls::TlsAcceptor,
74};