LostAttractor/kaguya
DevOps & Self-hostingProxy serversA Linux 6.13+ eBPF transparent proxy and programmable L7 gateway for routers and gateways.
What it is
Kaguya is a transparent network proxy and programmable L7 gateway built on Linux 6.13+ eBPF. Direct traffic stays in the kernel; selected proxied flows, DNS, and opted-in HTTP/1.1–H3 MITM traffic are handed to userspace. It targets people running a Linux gateway or router who need policy routing, domain-based routing without Fake-IP, TLS/HTTP interception, and full-stack traffic observability.
The project started as a fork of dae and has been substantially rewritten. It keeps authentic DNS answers: a WAL-persisted DomainRegistry records real IP-to-domain bindings and syncs them into eBPF maps across restarts, with TLS SNI and HTTP Host cross-checking so shared CDN IPs are not misrouted. MITM is limited to explicitly opted-in client devices and hosts.
Key capabilities from the README:
- Programmable L7 MITM across HTTP/1.1, HTTP/2, and HTTP/3, with Surge
.sgmodulesupport and a native Go plugin SDK; out-of-tree plugins include YouTube ad filtering and Bilibili sponsor-segment skipping. - Observability: a Web console (
Pancake), a terminal UI viakaguya observe ui, on-demand HTTPS inspection with redacted sensitive headers, Wireshark keylog streaming, andkaguya explainroute dry-runs. - HA and failover: per-mode health checks for
tcp4/tcp6/udp4/udp6, anti-flapping hysteresis, and kernel connectivity maps. - Live operations: config hot reload, same-PID binary replacement with
execve, suspend/resume, and a crash fallback policy (bypassorblock).
Quick start
Requirement: Linux 6.13+ on x86_64 or aarch64, with root privileges. Verify the kernel first:
sudo kaguya check-kernel
On a standard Linux install, copy the starter config and run the daemon:
sudo install -d -m 0755 /etc/kaguya /var/lib/kaguya
sudo cp example.kaguya /etc/kaguya/config.kaguya
sudo chmod 0600 /etc/kaguya/config.kaguya
sudo kaguya validate -c /etc/kaguya/config.kaguya
sudo kaguya run -c /etc/kaguya/config.kaguya
In another terminal, check a routing decision and open the TUI:
sudo kaguya explain route https://example.com --resolve
sudo kaguya observe ui
NixOS users can enable services.kaguya through the provided flake module; see the NixOS & Flake guide. To build from source, clone with submodules and run nix-shell --run make; without Nix, follow the build guide. Full routing, DNS, certificate, and API documentation is indexed in the English docs and Chinese docs.
Constraints
- Kernel and architecture: requires Linux 6.13+ on
x86_64oraarch64; older kernels are not supported. - Privileged operation: Kaguya attaches eBPF programs and manages routing, so it runs as root, and the docs cover systemd, Docker, and OpenRC deployment via the daemon guide.
- MITM scope: interception only applies to opted-in devices and hosts; everything else bypasses TLS. Custom CAs and certificate behavior are documented in the certificate guide.
- Memory budget: buffered HTTP/gRPC bodies reserve against a shared budget (default 256 MiB), which constrains large buffered transfers.
- OpenWRT is not yet supported; it remains on the TODO list.
- License: AGPL-3.0-only, which matters if you redistribute or network-expose modified versions.
HotRepo's take
Kaguya was first recorded on the Go new-project list on 2026-12-05, gaining 3 stars in about an hour of observation to reach 104 stars and 4 forks. The snapshot is short, so it does not establish a longer trend. The design choices that stand out for a routing gateway are the deliberate avoidance of Fake-IP, the bounded memory budget for buffered bodies, same-PID replacement that preserves systemd supervision and active connections, and a crash policy that can either fail open to kernel-native forwarding or fail closed to prevent leaks.
Written by AI from the project's public information and HotRepo's records, updated . The project's own docs are the source of truth.
You might also like
- daeuniverse/honkA Rust eBPF transparent proxy engine for Linux forwarding TCP and UDP traffic through configurable routing and outbound groups.
- SagerNet/sing-boxA universal proxy platform for building and running network proxy services, aimed at users who need self-hosted routing and tunneling.
- shitouxiaoge-commits/CFAPEXDeploy a Cloudflare-hosted proxy panel with VLESS/Trojan nodes and subscription output.
- everywall/ladderA self-hosted HTTP proxy that rewrites request and response headers per domain for testing paywall and content delivery behavior.
- byJoey/dunDeploy a self-hosted sing-box proxy stack on a VPS with one command, plus subscriptions and traffic routing.