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