# valdikss/goodbyedpi architecture

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

- Interactive diagram: https://gitdiagram.com/valdikss/goodbyedpi
- Repository: https://github.com/valdikss/goodbyedpi

## Overview

GoodbyeDPI is a Windows network utility for blocking passive DPI responses and circumventing active DPI through packet manipulation. The principal workflow is to start the program with options, configure packet handling, then process traffic using HTTP/TLS tricks, fake requests, and optional DNS redirection; tracking supports DNS reply redirection and automatic TTL handling. The README documents these capabilities, but the main packet loop is only partially excerpted, so several links to feature modules are shown as unverified. The graph also includes service hosting and the runtime state/helpers visible in sampled source.

Main entry points: [`src/goodbyedpi.c`](https://github.com/valdikss/goodbyedpi/blob/master/src/goodbyedpi.c) (Packet engine), [`src/dnsredir.c`](https://github.com/valdikss/goodbyedpi/blob/master/src/dnsredir.c) (DNS redirection), [`src/service.c`](https://github.com/valdikss/goodbyedpi/blob/master/src/service.c) (Windows service), [`src/blackwhitelist.c`](https://github.com/valdikss/goodbyedpi/blob/master/src/blackwhitelist.c) (Host blacklist)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime control"]
  node_engine["Packet engine<br/>[goodbyedpi.c]"]
  node_service["Windows service<br/>[service.c]"]
end

subgraph group_packet["Traffic circumvention"]
  node_http_tls["HTTP/TLS tricks<br/>[goodbyedpi.c]"]
  node_blacklist["Host blacklist<br/>[blackwhitelist.c]"]
  node_fake_packets["Fake packets<br/>[fakepackets.c]"]
  node_dns_redirect["DNS redirection<br/>[dnsredir.c]"]
end

subgraph group_tracking["Connection state"]
  node_dns_state[("DNS tracking<br/>[dnsredir.c]")]
  node_ttl_tracking[("TTL tracking<br/>[ttltrack.c]")]
end

subgraph group_support["Runtime support"]
  node_hash_support["Hash tables<br/>[uthash.h]"]
  node_line_reader["Line reader<br/>[getline.c]"]
  node_string_replace["String replacement<br/>[repl_str.c]"]
end

node_operator(("Windows operator"))

node_operator -->|"starts with options"| node_engine
node_engine -->|"registers service"| node_service
node_service -->|"calls main"| node_engine
node_service -->|"stops runtime"| node_engine
node_engine -.->|"processes traffic"| node_http_tls
node_engine -.->|"checks hostnames"| node_blacklist
node_engine -.->|"sends fakes"| node_fake_packets
node_engine -.->|"redirects DNS"| node_dns_redirect
node_engine -.->|"tracks TTL"| node_ttl_tracking
node_dns_redirect -->|"tracks requests"| node_dns_state
node_ttl_tracking -->|"stores records"| node_hash_support
node_dns_redirect -->|"stores records"| node_hash_support
node_blacklist -->|"reads lines"| node_line_reader
node_engine -.->|"rewrites strings"| node_string_replace
node_engine -->|"flushes DNS cache"| node_dns_redirect

click node_engine "https://github.com/valdikss/goodbyedpi/blob/master/src/goodbyedpi.c"
click node_service "https://github.com/valdikss/goodbyedpi/blob/master/src/service.c"
click node_http_tls "https://github.com/valdikss/goodbyedpi/blob/master/src/goodbyedpi.c"
click node_blacklist "https://github.com/valdikss/goodbyedpi/blob/master/src/blackwhitelist.c"
click node_fake_packets "https://github.com/valdikss/goodbyedpi/blob/master/src/fakepackets.c"
click node_dns_redirect "https://github.com/valdikss/goodbyedpi/blob/master/src/dnsredir.c"
click node_dns_state "https://github.com/valdikss/goodbyedpi/blob/master/src/dnsredir.c"
click node_ttl_tracking "https://github.com/valdikss/goodbyedpi/blob/master/src/ttltrack.c"
click node_hash_support "https://github.com/valdikss/goodbyedpi/blob/master/src/utils/uthash.h"
click node_line_reader "https://github.com/valdikss/goodbyedpi/blob/master/src/utils/getline.c"
click node_string_replace "https://github.com/valdikss/goodbyedpi/blob/master/src/utils/repl_str.c"

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_engine,node_service toneBlue
class node_http_tls,node_blacklist,node_fake_packets,node_dns_redirect toneAmber
class node_dns_state,node_ttl_tracking toneMint
class node_hash_support,node_line_reader,node_string_replace toneRose
class node_operator toneIndigo
```

## Components

### Runtime control

- [Packet engine](https://github.com/valdikss/goodbyedpi/blob/master/src/goodbyedpi.c): `src/goodbyedpi.c`
- [Windows service](https://github.com/valdikss/goodbyedpi/blob/master/src/service.c): `src/service.c`

### Traffic circumvention

- [HTTP/TLS tricks](https://github.com/valdikss/goodbyedpi/blob/master/src/goodbyedpi.c): `src/goodbyedpi.c`
- [Host blacklist](https://github.com/valdikss/goodbyedpi/blob/master/src/blackwhitelist.c): `src/blackwhitelist.c`
- [Fake packets](https://github.com/valdikss/goodbyedpi/blob/master/src/fakepackets.c): `src/fakepackets.c`
- [DNS redirection](https://github.com/valdikss/goodbyedpi/blob/master/src/dnsredir.c): `src/dnsredir.c`

### Connection state

- [DNS tracking](https://github.com/valdikss/goodbyedpi/blob/master/src/dnsredir.c): `src/dnsredir.c`
- [TTL tracking](https://github.com/valdikss/goodbyedpi/blob/master/src/ttltrack.c): `src/ttltrack.c`

### Runtime support

- [Hash tables](https://github.com/valdikss/goodbyedpi/blob/master/src/utils/uthash.h): `src/utils/uthash.h`
- [Line reader](https://github.com/valdikss/goodbyedpi/blob/master/src/utils/getline.c): `src/utils/getline.c`
- [String replacement](https://github.com/valdikss/goodbyedpi/blob/master/src/utils/repl_str.c): `src/utils/repl_str.c`

### Other components

- **Windows operator**

## Connections

- Windows operator → Packet engine: starts with options (evidence: `README.md`)
- Packet engine → Windows service: registers service (evidence: `src/goodbyedpi.c`)
- Windows service → Packet engine: calls main (evidence: `src/service.c`)
- Windows service → Packet engine: stops runtime (evidence: `src/service.c`)
- Packet engine → HTTP/TLS tricks: processes traffic (evidence: `src/goodbyedpi.c`)
- Packet engine → Host blacklist: checks hostnames
- Packet engine → Fake packets: sends fakes
- Packet engine → DNS redirection: redirects DNS
- Packet engine → TTL tracking: tracks TTL
- DNS redirection → DNS tracking: tracks requests (evidence: `src/dnsredir.c`)
- TTL tracking → Hash tables: stores records (evidence: `src/ttltrack.c`)
- DNS redirection → Hash tables: stores records (evidence: `src/dnsredir.c`)
- Host blacklist → Line reader: reads lines (evidence: `src/blackwhitelist.c`)
- Packet engine → String replacement: rewrites strings
- Packet engine → DNS redirection: flushes DNS cache (evidence: `src/goodbyedpi.c`)
