hyperlane-plugin-cors 23.0.0

A zero-allocation precompiled CORS plugin for the Hyperlane framework with exact/suffix/predicate origin matching, safe credential reflection, RFC preflight handling, and Vary header merging.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use super::*;

/// Origin matching policy for [`CorsConfig`].
#[derive(Clone, Default)]
pub enum AllowOrigin {
    /// Permits any incoming origin (`*` without credentials, or reflected origin with credentials).
    #[default]
    Any,
    /// Permits only origins matching an `O(1)` `XxHash3_64` exact-match set (ASCII case-insensitive).
    Exact(HashSetXxHash3_64<String>),
    /// Permits origins whose host ends with any configured suffix (for example `".example.com"`).
    Suffix(Vec<String>),
    /// Evaluates incoming origins using a user-supplied predicate callback.
    Custom(OriginMatcher),
}