pingora_core/lib.rs
1// Copyright 2025 Cloudflare, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#![warn(clippy::all)]
16#![allow(clippy::new_without_default)]
17#![allow(clippy::type_complexity)]
18#![allow(clippy::match_wild_err_arm)]
19#![allow(clippy::missing_safety_doc)]
20#![allow(clippy::upper_case_acronyms)]
21
22//! # Pingora
23//!
24//! Pingora is a collection of service frameworks and network libraries battle-tested by the Internet.
25//! It is to build robust, scalable and secure network infrastructures and services at Internet scale.
26//!
27//! # Features
28//! - Http 1.x and Http 2
29//! - Modern TLS with OpenSSL or BoringSSL (FIPS compatible)
30//! - Zero downtime upgrade
31//!
32//! # Usage
33//! This crate provides low level service and protocol implementation and abstraction.
34//!
35//! If looking to build a (reverse) proxy, see [`pingora-proxy`](https://docs.rs/pingora-proxy) crate.
36//!
37//! # Optional features
38//! `boringssl`: Switch the internal TLS library from OpenSSL to BoringSSL.
39
40// This enables the feature that labels modules that are only available with
41// certain pingora features
42#![cfg_attr(docsrs, feature(doc_cfg))]
43
44pub mod apps;
45pub mod connectors;
46pub mod listeners;
47pub mod modules;
48pub mod protocols;
49pub mod server;
50pub mod services;
51pub mod upstreams;
52pub mod utils;
53
54pub use pingora_error::{ErrorType::*, *};
55
56// If both openssl and boringssl are enabled, prefer boringssl.
57// This is to make sure that boringssl can override the default openssl feature
58// when this crate is used indirectly by other crates.
59#[cfg(feature = "boringssl")]
60pub use pingora_boringssl as tls;
61
62#[cfg(feature = "openssl")]
63pub use pingora_openssl as tls;
64
65#[cfg(feature = "rustls")]
66pub use pingora_rustls as tls;
67
68#[cfg(not(feature = "any_tls"))]
69pub use protocols::tls::noop_tls as tls;
70
71pub mod prelude {
72 pub use crate::server::configuration::Opt;
73 pub use crate::server::Server;
74 pub use crate::services::background::background_service;
75 pub use crate::upstreams::peer::HttpPeer;
76 pub use pingora_error::{ErrorType::*, *};
77}