Skip to main content

hyperlane_plugin_cors/
lib.rs

1//! hyperlane-plugin-cors
2//!
3//! Zero-allocation precompiled Cross-Origin Resource Sharing (CORS) plugin for
4//! Hyperlane with `XxHash3_64` origin matching, safe credential reflection,
5//! preflight handling, and `Vary` merging.
6
7mod r#const;
8mod r#enum;
9mod r#fn;
10mod r#impl;
11mod r#static;
12mod r#struct;
13mod r#type;
14
15#[cfg(test)]
16#[path = "../tests/mod.rs"]
17mod tests;
18
19pub use {r#const::*, r#enum::*, r#struct::*, r#type::*};
20
21pub(crate) use {r#fn::*, r#static::*};
22
23use std::{
24    collections::VecDeque,
25    fmt::{self, Debug, Formatter},
26    str::from_utf8,
27    sync::{Arc, OnceLock},
28};
29
30use {
31    hyperlane::{
32        ACCESS_CONTROL_ALLOW_CREDENTIALS, ACCESS_CONTROL_ALLOW_HEADERS,
33        ACCESS_CONTROL_ALLOW_METHODS, ACCESS_CONTROL_ALLOW_ORIGIN, ACCESS_CONTROL_EXPOSE_HEADERS,
34        ACCESS_CONTROL_MAX_AGE, ACCESS_CONTROL_REQUEST_HEADERS, ACCESS_CONTROL_REQUEST_METHOD,
35        Context, HashSetXxHash3_64, HttpStatus, ORIGIN, Request, Response, ResponseError,
36        ServerHook, Status, Stream, VARY, hash_set_xx_hash3_64,
37    },
38    lombok_macros::*,
39};