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;
20mod tls;
21
22pub use {config::*, context::*, error::*, hook::*, route::*, server::*};
23
24pub use {http_type::*, inventory};
25
26pub(crate) use {listener::*, protocol::*, tls::*};
27
28use std::{
29    any::Any,
30    cmp::Ordering,
31    collections::HashSet,
32    future::{Future, poll_fn},
33    hash::{Hash, Hasher},
34    io::{self, Write, stderr, stdout},
35    mem,
36    net::{AddrParseError, SocketAddr},
37    num::ParseIntError,
38    panic::AssertUnwindSafe,
39    pin::Pin,
40    ptr,
41    str::{Split, SplitWhitespace, Utf8Error, from_utf8},
42    sync::Arc,
43    task::{self, Poll},
44    time::Duration,
45};
46
47use {
48    bytes::Bytes,
49    futures::FutureExt,
50    h3::error::Code,
51    inventory::collect,
52    lombok_macros::*,
53    quinn::{self, Endpoint, Incoming, VarInt},
54    regex::Regex,
55    rustls::pki_types::{
56        CertificateDer, PrivateKeyDer,
57        pem::{self, PemObject},
58    },
59    serde::{Deserialize, Serialize},
60    tokio::{
61        io::{AsyncRead, AsyncWrite, AsyncWriteExt, ReadBuf},
62        join,
63        net::{TcpListener, TcpStream},
64        spawn,
65        sync::watch::{Receiver, Sender, channel},
66        task::JoinHandle,
67        time::timeout,
68    },
69    tokio_rustls::TlsAcceptor,
70};