# 2grey/awg-openwrt architecture

> Architecture diagram of the GitHub repository 2grey/awg-openwrt, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/2grey/awg-openwrt
- Repository: https://github.com/2grey/awg-openwrt

## Overview

This repository delivers AmneziaWG support for OpenWrt: kernel and userspace packages, LuCI configuration and status pages, and installation paths. The principal workflow is installing the packages, configuring an interface and peers through LuCI or the setup script, then viewing live status. The README also documents signed package feeds, configuration import/export, router diagnostics, and firewall/routing setup. Source excerpts show the LuCI protocol and status RPC calls; implementation details for the shell scripts, kernel module, and tools were not sampled, so their internal relationships are documented at the README level.

Main entry points: [`amneziawg-install.sh`](https://github.com/2grey/awg-openwrt/blob/master/amneziawg-install.sh) (Setup installer), [`luci-proto-amneziawg/htdocs/luci-static/resources/protocol/amneziawg.js`](https://github.com/2grey/awg-openwrt/blob/master/luci-proto-amneziawg/htdocs/luci-static/resources/protocol/amneziawg.js) (Interface configuration), [`luci-proto-amneziawg/root/usr/share/rpcd/ucode/luci.amneziawg`](https://github.com/2grey/awg-openwrt/blob/master/luci-proto-amneziawg/root/usr/share/rpcd/ucode/luci.amneziawg) (LuCI RPC service), [`amneziawg-feed-install.sh`](https://github.com/2grey/awg-openwrt/blob/master/amneziawg-feed-install.sh) (Feed installer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_install["Installation and feeds"]
  node_feed[("Signed package feed")]
  node_feed_installer["Feed installer"]
end

subgraph group_runtime["Tunnel runtime"]
  node_tools["AWG tools<br/>[amneziawg.sh]"]
  node_watchdog["Interface watchdog"]
  node_kernel["Kernel module"]
  node_uci[("OpenWrt interface config")]
  node_firewall["Firewall and routes"]
end

subgraph group_luci["LuCI management"]
  node_luci_protocol["Interface configuration<br/>[amneziawg.js]"]
  node_legacy_protocol["Legacy configuration<br/>[amneziawg.js]"]
  node_status["Live status view<br/>[status.js]"]
  node_legacy_status["Legacy status view<br/>[status.js]"]
  node_rpc["LuCI RPC service<br/>[luci.amneziawg]"]
end

subgraph group_ops["Setup and diagnostics"]
  node_setup["Setup installer"]
  node_diagnostics["Router diagnostics<br/>[amneziawg-check.sh]"]
end

node_operator(("Router operator"))
node_router(("OpenWrt router"))

node_operator -->|"runs installer"| node_feed_installer
node_feed_installer -->|"installs packages"| node_feed
node_operator -->|"runs installer"| node_setup
node_setup -->|"installs tools"| node_tools
node_setup -->|"installs module"| node_kernel
node_setup -->|"configures interface"| node_uci
node_setup -->|"configures rules"| node_firewall
node_setup -->|"routes allowed IPs"| node_firewall
node_operator -->|"runs check"| node_diagnostics
node_operator -->|"configures VPN"| node_luci_protocol
node_luci_protocol -->|"reads and writes"| node_uci
node_luci_protocol -->|"requests key operations"| node_rpc
node_operator -->|"configures VPN"| node_legacy_protocol
node_legacy_protocol -->|"reads and writes"| node_uci
node_operator -->|"views status"| node_status
node_status -->|"polls instances"| node_rpc
node_operator -->|"views status"| node_legacy_status
node_legacy_status -->|"polls instances"| node_rpc
node_tools -.->|"manages tunnel"| node_kernel
node_watchdog -.->|"monitors interface"| node_router

click node_feed_installer "https://github.com/2grey/awg-openwrt/blob/master/amneziawg-feed-install.sh"
click node_setup "https://github.com/2grey/awg-openwrt/blob/master/amneziawg-install.sh"
click node_diagnostics "https://github.com/2grey/awg-openwrt/blob/master/amneziawg-check.sh"
click node_tools "https://github.com/2grey/awg-openwrt/blob/master/amneziawg-tools/files/amneziawg.sh"
click node_watchdog "https://github.com/2grey/awg-openwrt/blob/master/amneziawg-tools/files/amneziawg_watchdog"
click node_kernel "https://github.com/2grey/awg-openwrt/tree/master/kmod-amneziawg"
click node_luci_protocol "https://github.com/2grey/awg-openwrt/blob/master/luci-proto-amneziawg/htdocs/luci-static/resources/protocol/amneziawg.js"
click node_legacy_protocol "https://github.com/2grey/awg-openwrt/blob/master/luci-app-amneziawg/htdocs/luci-static/resources/protocol/amneziawg.js"
click node_status "https://github.com/2grey/awg-openwrt/blob/master/luci-proto-amneziawg/htdocs/luci-static/resources/view/amneziawg/status.js"
click node_legacy_status "https://github.com/2grey/awg-openwrt/blob/master/luci-app-amneziawg/htdocs/luci-static/resources/view/amneziawg/status.js"
click node_rpc "https://github.com/2grey/awg-openwrt/blob/master/luci-proto-amneziawg/root/usr/share/rpcd/ucode/luci.amneziawg"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_feed,node_feed_installer toneBlue
class node_tools,node_watchdog,node_kernel,node_uci,node_firewall toneAmber
class node_luci_protocol,node_legacy_protocol,node_status,node_legacy_status,node_rpc,node_operator,node_router toneMint
class node_setup,node_diagnostics toneRose
```

## Components

### Installation and feeds

- **Signed package feed**
- [Feed installer](https://github.com/2grey/awg-openwrt/blob/master/amneziawg-feed-install.sh): `amneziawg-feed-install.sh`

### Tunnel runtime

- [AWG tools](https://github.com/2grey/awg-openwrt/blob/master/amneziawg-tools/files/amneziawg.sh): `amneziawg-tools/files/amneziawg.sh`
- [Interface watchdog](https://github.com/2grey/awg-openwrt/blob/master/amneziawg-tools/files/amneziawg_watchdog): `amneziawg-tools/files/amneziawg_watchdog`
- [Kernel module](https://github.com/2grey/awg-openwrt/tree/master/kmod-amneziawg): `kmod-amneziawg`
- **OpenWrt interface config**
- **Firewall and routes**

### LuCI management

- [Interface configuration](https://github.com/2grey/awg-openwrt/blob/master/luci-proto-amneziawg/htdocs/luci-static/resources/protocol/amneziawg.js): `luci-proto-amneziawg/htdocs/luci-static/resources/protocol/amneziawg.js`
- [Legacy configuration](https://github.com/2grey/awg-openwrt/blob/master/luci-app-amneziawg/htdocs/luci-static/resources/protocol/amneziawg.js): `luci-app-amneziawg/htdocs/luci-static/resources/protocol/amneziawg.js`
- [Live status view](https://github.com/2grey/awg-openwrt/blob/master/luci-proto-amneziawg/htdocs/luci-static/resources/view/amneziawg/status.js): `luci-proto-amneziawg/htdocs/luci-static/resources/view/amneziawg/status.js`
- [Legacy status view](https://github.com/2grey/awg-openwrt/blob/master/luci-app-amneziawg/htdocs/luci-static/resources/view/amneziawg/status.js): `luci-app-amneziawg/htdocs/luci-static/resources/view/amneziawg/status.js`
- [LuCI RPC service](https://github.com/2grey/awg-openwrt/blob/master/luci-proto-amneziawg/root/usr/share/rpcd/ucode/luci.amneziawg): `luci-proto-amneziawg/root/usr/share/rpcd/ucode/luci.amneziawg`

### Setup and diagnostics

- [Setup installer](https://github.com/2grey/awg-openwrt/blob/master/amneziawg-install.sh): `amneziawg-install.sh`
- [Router diagnostics](https://github.com/2grey/awg-openwrt/blob/master/amneziawg-check.sh): `amneziawg-check.sh`

### Other components

- **Router operator**
- **OpenWrt router**

## Connections

- Router operator → Feed installer: runs installer (evidence: `README.md`)
- Feed installer → Signed package feed: installs packages (evidence: `README.md`)
- Router operator → Setup installer: runs installer (evidence: `README.md`)
- Setup installer → AWG tools: installs tools (evidence: `README.md`)
- Setup installer → Kernel module: installs module (evidence: `README.md`)
- Setup installer → OpenWrt interface config: configures interface (evidence: `README.md`)
- Setup installer → Firewall and routes: configures rules (evidence: `README.md`)
- Setup installer → Firewall and routes: routes allowed IPs (evidence: `README.md`)
- Router operator → Router diagnostics: runs check (evidence: `README.md`)
- Router operator → Interface configuration: configures VPN (evidence: `README.md`)
- Interface configuration → OpenWrt interface config: reads and writes (evidence: `luci-proto-amneziawg/htdocs/luci-static/resources/protocol/amneziawg.js`)
- Interface configuration → LuCI RPC service: requests key operations (evidence: `luci-proto-amneziawg/htdocs/luci-static/resources/protocol/amneziawg.js`)
- Router operator → Legacy configuration: configures VPN (evidence: `README.md`)
- Legacy configuration → OpenWrt interface config: reads and writes (evidence: `luci-app-amneziawg/htdocs/luci-static/resources/protocol/amneziawg.js`)
- Router operator → Live status view: views status (evidence: `README.md`)
- Live status view → LuCI RPC service: polls instances (evidence: `luci-proto-amneziawg/htdocs/luci-static/resources/view/amneziawg/status.js`)
- Router operator → Legacy status view: views status (evidence: `luci-app-amneziawg/htdocs/luci-static/resources/view/amneziawg/status.js`)
- Legacy status view → LuCI RPC service: polls instances (evidence: `luci-app-amneziawg/htdocs/luci-static/resources/view/amneziawg/status.js`)
- AWG tools → Kernel module: manages tunnel
- Interface watchdog → OpenWrt router: monitors interface
