Expand description
🦙 rama (ラマ) is a modular service framework for building network services in Rust.
Rama is intentionally explicit: clients, servers, transports, protocols, middleware, and state are composed as services and layers. This keeps the shape of your network stack visible in code.
§Start here
| If you want to… | Go here |
|---|---|
| Learn the model | https://ramaproxy.org/book/intro.html |
| Understand why Rama exists | https://ramaproxy.org/book/why_rama.html |
| Run examples | https://github.com/plabayo/rama/tree/main/examples |
| Build proxies | https://ramaproxy.org/book/proxies/intro.html |
| Build HTTP services | https://ramaproxy.org/book/web_servers.html |
| Use the CLI | https://ramaproxy.org/book/deploy/rama-cli.html |
§Main API areas
| API | Purpose |
|---|---|
Service, Layer | Core service and middleware traits |
http | HTTP clients, servers, services, layers, WebSockets, gRPC |
proxy | Proxy primitives, SOCKS5, HAProxy PROXY protocol |
tcp, udp, unix | Transport listeners, connectors, and streams |
tls | TLS abstractions, Rustls, BoringSSL, ACME |
dns | DNS resolvers and related types |
net | Network addresses, sockets, forwarding, fingerprints |
ua | User-Agent parsing, profiles, and emulation |
telemetry | tracing and OpenTelemetry integration |
utils | Utilities, including Tower compatibility |
§Common entry points
| Goal | API |
|---|---|
| Write a service | Service |
| Add middleware | Layer |
| Build an HTTP server | http::server |
| Route HTTP requests | http::service::web |
| Build an HTTP client | http::client::EasyHttpWebClient |
| Use high-level client helpers | http::service::client::HttpClientExt |
| Build HTTP proxy flows | http::proxy |
| Build SOCKS5 proxy flows | proxy::socks5 |
| Build Linux transparent proxy flows | linux_tproxy_tcp.rs |
| Build Apple transparent proxy flows | ffi/apple/examples/transparent_proxy |
§Feature flags
The top-level rama crate is modular. Many modules are enabled through feature
flags. The docs on docs.rs are built with all features enabled.
§More
- Website and full feature overview: https://ramaproxy.org/#features-table
- Book: https://ramaproxy.org/book
- Examples: https://github.com/plabayo/rama/tree/main/examples
- README and crate overview: https://github.com/plabayo/rama
- Edge docs: https://ramaproxy.org/docs/rama
Modules§
- bytes
- Re-export of bytes crate.
- cli
cliandstd - rama cli utilities
- combinators
- Combinators for working with or in function of services.
- conversion
- crypto
cryptoandstd - Crypto primitives and dependencies used by rama.
- dns
dnsandstd - DNS support for Rama.
- error
- Error utilities for Rama and its users.
- error_
sink - A reusable sink for errors that occur in fire-and-forget contexts.
- extensions
- Extensions passed to and between services
- futures
- Re-export of the futures and asynk-strim crates.
- gateway
fastcgiandstd - Application server gateway protocols (FastCGI, and similar).
- geo
- Geographic identity types shared across rama.
- graceful
std - Shutdown management for graceful shutdown of async-first applications.
- http
httpandstd - rama http support
- io
std - json
std - Streaming JSON tools for Rama.
- layer
- Layer type and utilities.
- matcher
- Matcher utilities for any middleware where need to match on incoming inputs.
- net
net - proxy
haproxyandstd, orproxyandstd, orsocks5andstd - rama proxy support
- rt
std - Runtime utilities used by Rama.
- service
- Service type and utilities.
- stream
std - tcp
stdandtcp - TCP support for Rama.
- telemetry
std - Rama telemetry modules.
- tls
acmeandstd, orboringandstd, orrustlsandstd, orstdandtls - ttrpc
ttrpc - ttRPC (“gRPC for low-memory environments”) support.
- ua
stdandua - User Agent (UA) parser and profiles.
- udp
stdandudp - UDP module for Rama.
- unix
target_family=unixandunix - Unix (Domain) socket support for Rama.
- username
- Utilities to work with usernames and pull information out of it.
- utils
- utilities for rama
Structs§
- Service
Input std - A generic service input that implements all rama traits conditionally