How linkerd/linkerd2-proxy works
Project Type & Purpose
• This is a full-featured, micro-modular network proxy implemented in Rust, intended to serve as the Linkerd2 “sidecar” for Kubernetes-style environments.
• It provides transparent proxying for HTTP/1.x, HTTP/2, WebSockets, and raw TCP, with built-in mTLS, load balancing (L4 and L7), Prometheus metrics, and a tap API.
• The README confirms it compiles into a single linkerd2-proxy executable backed by many smaller crates (libraries), and integrates tightly with a Linkerd control plane via gRPC (the Destination API) and a SPIFFE-based identity service.
File Structure Analysis
• Top-level crates:
• linkerd2-proxy (binary entry point)
• linkerd/app (app layer with inbound/outbound, gateway, admin, core)
• linkerd/proxy/* (core proxy building blocks: HTTP, TCP, transport, balance, client/server policy, tap)
• linkerd/tls, linkerd/identity, linkerd/distribute, linkerd/meshtls, linkerd/metrics, etc.
• linkerd2-app-integration (integration tests under linkerd/app/integration)
• Patterns:
• “Layered Service” design built atop Tower Service traits: each crate provides layers (retry, timeout, metrics, load-balance) composed into inbound and outbound pipelines.
• Clear separation: inbound pipeline (handling traffic toward the local application), outbound pipeline (application-to-service), plus a control-plane gateway and admin API.
• Fuzzing harnesses and GitHub workflows for CI/security.
README Insights
• Confirms the executable is linkerd2-proxy, which pulls in linkerd/app/inbound and linkerd/app/outbound.
• Mentions automatic Prometheus export and transparent mTLS.
• Describes service-discovery via DNS and Destination gRPC API.