# nfqws/nfqws2-keenetic architecture

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

- Interactive diagram: https://gitdiagram.com/nfqws/nfqws2-keenetic
- Repository: https://github.com/nfqws/nfqws2-keenetic

## Overview

This repository packages and integrates nfqws2 for router firmware rather than implementing the packet-modification engine itself. The user installs the package on an Entware-based router (with an OpenWrt-specific entry point also present); during operation, nfqws2 modifies TCP traffic handled through NFQUEUE and raw sockets. Configuration, lists, and payload blobs are distinct runtime inputs. No source excerpts were provided, so internal call relationships are omitted; dashed links indicate likely runtime wiring that the available documentation does not verify.

Main entry points: [`etc/nfqws2/nfqws2.conf`](https://github.com/nfqws/nfqws2-keenetic/blob/master/etc/nfqws2/nfqws2.conf) (Main configuration), [`etc/nfqws2/lists`](https://github.com/nfqws/nfqws2-keenetic/tree/master/etc/nfqws2/lists) (Domain lists), [`etc/nfqws2/blobs`](https://github.com/nfqws/nfqws2-keenetic/tree/master/etc/nfqws2/blobs) (Protocol blobs), [`etc/init.d`](https://github.com/nfqws/nfqws2-keenetic/tree/master/etc/init.d) (Entware lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Traffic processing"]
  node_nfqws_engine["nfqws2 engine"]
  node_nfqueue{{"NFQUEUE and raw sockets"}}
end

subgraph group_config["Runtime configuration"]
  node_main_config["Main configuration<br/>[nfqws2.conf]"]
  node_domain_lists["Domain lists"]
  node_payload_blobs["Protocol blobs"]
end

subgraph group_integration["Router integration"]
  node_entware_init["Entware lifecycle<br/>[init.d]"]
  node_ndm_hook["NDM netfilter hook<br/>[100-nfqws2.sh]"]
  node_openwrt_entry["OpenWrt entry point<br/>[entrypoint.sh]"]
  node_ipk_hooks["IPK lifecycle hooks"]
end

node_router_user(("Router administrator"))
node_router_traffic(("Router traffic"))

node_router_user -->|"installs package"| node_nfqws_engine
node_router_traffic -->|"processes TCP"| node_nfqws_engine
node_nfqws_engine -->|"uses"| node_nfqueue
node_main_config -.->|"configures"| node_nfqws_engine
node_domain_lists -.->|"supplies rules"| node_nfqws_engine
node_payload_blobs -.->|"supplies payloads"| node_nfqws_engine
node_entware_init -.->|"manages lifecycle"| node_nfqws_engine
node_ndm_hook -.->|"integrates traffic"| node_nfqws_engine
node_openwrt_entry -.->|"starts runtime"| node_nfqws_engine
node_ipk_hooks -.->|"manages package"| node_nfqws_engine

click node_main_config "https://github.com/nfqws/nfqws2-keenetic/blob/master/etc/nfqws2/nfqws2.conf"
click node_domain_lists "https://github.com/nfqws/nfqws2-keenetic/tree/master/etc/nfqws2/lists"
click node_payload_blobs "https://github.com/nfqws/nfqws2-keenetic/tree/master/etc/nfqws2/blobs"
click node_entware_init "https://github.com/nfqws/nfqws2-keenetic/tree/master/etc/init.d"
click node_ndm_hook "https://github.com/nfqws/nfqws2-keenetic/blob/master/etc/ndm/netfilter.d/100-nfqws2.sh"
click node_openwrt_entry "https://github.com/nfqws/nfqws2-keenetic/blob/master/openwrt/entrypoint.sh"
click node_ipk_hooks "https://github.com/nfqws/nfqws2-keenetic/tree/master/common/ipk"

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_nfqws_engine,node_nfqueue toneBlue
class node_main_config,node_domain_lists,node_payload_blobs toneAmber
class node_entware_init,node_ndm_hook,node_openwrt_entry,node_ipk_hooks,node_router_user,node_router_traffic toneMint
```

## Components

### Traffic processing

- **nfqws2 engine**
- **NFQUEUE and raw sockets**

### Runtime configuration

- [Main configuration](https://github.com/nfqws/nfqws2-keenetic/blob/master/etc/nfqws2/nfqws2.conf): `etc/nfqws2/nfqws2.conf`
- [Domain lists](https://github.com/nfqws/nfqws2-keenetic/tree/master/etc/nfqws2/lists): `etc/nfqws2/lists`
- [Protocol blobs](https://github.com/nfqws/nfqws2-keenetic/tree/master/etc/nfqws2/blobs): `etc/nfqws2/blobs`

### Router integration

- [Entware lifecycle](https://github.com/nfqws/nfqws2-keenetic/tree/master/etc/init.d): `etc/init.d`
- [NDM netfilter hook](https://github.com/nfqws/nfqws2-keenetic/blob/master/etc/ndm/netfilter.d/100-nfqws2.sh): `etc/ndm/netfilter.d/100-nfqws2.sh`
- [OpenWrt entry point](https://github.com/nfqws/nfqws2-keenetic/blob/master/openwrt/entrypoint.sh): `openwrt/entrypoint.sh`
- [IPK lifecycle hooks](https://github.com/nfqws/nfqws2-keenetic/tree/master/common/ipk): `common/ipk`

### Other components

- **Router administrator**
- **Router traffic**

## Connections

- Router administrator → nfqws2 engine: installs package (evidence: `README.md`)
- Router traffic → nfqws2 engine: processes TCP (evidence: `README.md`)
- nfqws2 engine → NFQUEUE and raw sockets: uses (evidence: `README.md`)
- Main configuration → nfqws2 engine: configures
- Domain lists → nfqws2 engine: supplies rules
- Protocol blobs → nfqws2 engine: supplies payloads
- Entware lifecycle → nfqws2 engine: manages lifecycle
- NDM netfilter hook → nfqws2 engine: integrates traffic
- OpenWrt entry point → nfqws2 engine: starts runtime
- IPK lifecycle hooks → nfqws2 engine: manages package
