#![forbid(unsafe_code)]
#![warn(missing_docs)]
pub mod auth;
pub mod events;
mod middleware;
pub mod rpc;
mod server;
#[cfg(feature = "ui")]
pub mod ui_server;
pub use auth::{AuthConfig, AuthError, AuthState, User, UserRole, UserStore};
pub use events::{EventBroadcaster, UiEvent, UiEventEnvelope};
pub use middleware::GatewayRateLimiter;
pub use rpc::{RpcError, RpcRequest, RpcResponse};
pub use server::{Gateway, GatewayBuilder, GatewayConfig, GatewayState};
#[cfg(feature = "ui")]
pub use ui_server::UiServerConfig;
pub async fn start(config: GatewayConfig) -> Result<(), GatewayError> {
let gateway = Gateway::new(config)?;
gateway.run().await
}
#[derive(Debug, thiserror::Error)]
pub enum GatewayError {
#[error("Server error: {0}")]
Server(String),
#[error("Config error: {0}")]
Config(String),
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
}