Skip to main content

byokey_proxy/handler/
mod.rs

1//! HTTP route handlers for all proxy endpoints.
2//!
3//! - [`chat`] / [`messages`] / [`models`] — `OpenAI`-compatible API.
4//! - [`amp`] / [`amp_provider`]           — Amp CLI / `AmpCode` compatibility.
5//! - [`accounts`] / [`status`] / [`ratelimits`] — Management API.
6
7pub mod accounts;
8pub(crate) mod amp;
9pub(crate) mod amp_provider;
10pub mod amp_quota;
11pub mod amp_threads;
12pub(crate) mod chat;
13pub(crate) mod messages;
14pub(crate) mod models;
15pub mod ratelimits;
16pub mod status;
17pub mod usage;
18
19// ── Shared header-filtering constants for proxy handlers ────────────
20
21/// Headers that must not be forwarded (hop-by-hop per RFC 2616 §13.5.1).
22pub(crate) const HOP_BY_HOP: &[&str] = &[
23    "connection",
24    "keep-alive",
25    "proxy-authenticate",
26    "proxy-authorization",
27    "te",
28    "trailers",
29    "transfer-encoding",
30    "upgrade",
31];
32
33/// Authentication headers stripped from client requests in shared-proxy mode.
34pub(crate) const CLIENT_AUTH_HEADERS: &[&str] = &["authorization", "x-api-key", "x-goog-api-key"];
35
36/// Headers that can fingerprint or reveal the client's network identity.
37pub(crate) const FINGERPRINT_HEADERS: &[&str] = &[
38    "x-forwarded-for",
39    "x-forwarded-host",
40    "x-forwarded-proto",
41    "x-real-ip",
42    "forwarded",
43    "via",
44    "priority",
45];