# openwrtbuild/fastgithub architecture

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

- Interactive diagram: https://gitdiagram.com/openwrtbuild/fastgithub
- Repository: https://github.com/openwrtbuild/fastgithub

## Overview

FastGithub is a local GitHub acceleration proxy: clients send HTTP/HTTPS traffic through its proxy endpoint, while domain resolution, per-domain settings, and proxy handlers shape outbound connections. It also supports DNS/TCP interception, TLS certificate generation, flow analysis, and a desktop UI. The graph includes documented capabilities whose implementation was not sampled; those links are marked unverified rather than inferred from names alone.

Main entry points: [`FastGithub.DomainResolve/DomainResolver.cs`](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.DomainResolve/DomainResolver.cs) (Domain resolver), [`FastGithub.HttpServer/HttpMiddlewares/HttpReverseProxyMiddleware.cs`](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.HttpServer/HttpMiddlewares/HttpReverseProxyMiddleware.cs) (HTTP reverse proxy), [`FastGithub.Http/HttpClientHandler.cs`](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.Http/HttpClientHandler.cs) (Resolved socket connect), [`FastGithub/Program.cs`](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub/Program.cs) (Application host)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and settings"]
  node_desktop["Desktop UI<br/>[Program.cs]"]
  node_host["Application host<br/>[Program.cs]"]
  node_appservice["App lifecycle"]
  node_settings["Domain settings"]
  node_domainconfig["Domain policies<br/>[DomainConfig.cs]"]
end

subgraph group_resolve["Domain resolution"]
  node_resolver["Domain resolver<br/>[DomainResolver.cs]"]
  node_dnsclient["DNS lookup<br/>[DnsClient.cs]"]
  node_persist["Resolution persistence"]
end

subgraph group_proxy["Proxy and TLS"]
  node_httpclient["Outbound HTTP client<br/>[HttpClient.cs]"]
  node_httpconnect["Resolved socket connect"]
  node_httpmiddleware["HTTP reverse proxy"]
  node_tcpreverse["TCP reverse proxy"]
  node_certservice["Certificate service<br/>[CertService.cs]"]
  node_certgenerator["Certificate generator<br/>[CertGenerator.cs]"]
end

subgraph group_intercept["Packet interception"]
  node_dnsintercept["DNS interception<br/>[DnsInterceptor.cs]"]
  node_dnsservice["DNS intercept service"]
  node_tcpintercept["TCP interception<br/>[TcpInterceptor.cs]"]
end

subgraph group_observability["UI and flow"]
  node_flow["Flow analysis<br/>[FlowAnalyzer.cs]"]
  node_uiwindow["Desktop window<br/>[MainWindow.xaml.cs]"]
end

node_client(("Local client"))
node_remote(("GitHub and other sites"))

node_client -->|"proxies through"| node_httpmiddleware
node_desktop -->|"starts process"| node_host
node_host -.->|"runs lifecycle"| node_appservice
node_settings -->|"builds policies"| node_domainconfig
node_httpclient -->|"uses handler"| node_httpconnect
node_httpconnect -->|"resolves endpoints"| node_resolver
node_tcpreverse -->|"resolves endpoints"| node_resolver
node_httpmiddleware -->|"forwards requests"| node_httpclient
node_dnsclient -->|"reads fallback DNS"| node_settings
node_resolver -.->|"performs lookups"| node_dnsclient
node_resolver -.->|"persists results"| node_persist
node_dnsservice -->|"runs interception"| node_dnsintercept
node_tcpintercept -.->|"intercepts traffic"| node_remote
node_certservice -->|"creates certificates"| node_certgenerator
node_httpmiddleware -.->|"forwards traffic"| node_remote
node_flow -.->|"displays statistics"| node_uiwindow
node_client -.->|"uses DNS interception"| node_dnsintercept
node_resolver -.->|"selects fastest IP"| node_remote
node_domainconfig -->|"sets TLS and IP policy"| node_httpconnect

click node_desktop "https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.UI/Program.cs"
click node_host "https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub/Program.cs"
click node_appservice "https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub/AppHostedService.cs"
click node_settings "https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.Configuration/FastGithubConfig.cs"
click node_domainconfig "https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.Configuration/DomainConfig.cs"
click node_resolver "https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.DomainResolve/DomainResolver.cs"
click node_dnsclient "https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.DomainResolve/DnsClient.cs"
click node_persist "https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.DomainResolve/PersistenceService.cs"
click node_httpclient "https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.Http/HttpClient.cs"
click node_httpconnect "https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.Http/HttpClientHandler.cs"
click node_httpmiddleware "https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.HttpServer/HttpMiddlewares/HttpReverseProxyMiddleware.cs"
click node_tcpreverse "https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.HttpServer/TcpMiddlewares/TcpReverseProxyHandler.cs"
click node_certservice "https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.HttpServer/Certs/CertService.cs"
click node_certgenerator "https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.HttpServer/Certs/CertGenerator.cs"
click node_dnsintercept "https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.PacketIntercept/Dns/DnsInterceptor.cs"
click node_dnsservice "https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.PacketIntercept/DnsInterceptHostedService.cs"
click node_tcpintercept "https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.PacketIntercept/Tcp/TcpInterceptor.cs"
click node_flow "https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.FlowAnalyze/FlowAnalyzer.cs"
click node_uiwindow "https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.UI/MainWindow.xaml.cs"

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_desktop,node_host,node_appservice,node_settings,node_domainconfig,node_client toneBlue
class node_resolver,node_dnsclient,node_persist toneAmber
class node_httpclient,node_httpconnect,node_httpmiddleware,node_tcpreverse,node_certservice,node_certgenerator toneMint
class node_dnsintercept,node_dnsservice,node_tcpintercept toneRose
class node_flow,node_uiwindow,node_remote toneIndigo
```

## Components

### Entry and settings

- [Desktop UI](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.UI/Program.cs): `FastGithub.UI/Program.cs`
- [Application host](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub/Program.cs): `FastGithub/Program.cs`
- [App lifecycle](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub/AppHostedService.cs): `FastGithub/AppHostedService.cs`
- [Domain settings](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.Configuration/FastGithubConfig.cs): `FastGithub.Configuration/FastGithubConfig.cs`
- [Domain policies](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.Configuration/DomainConfig.cs): `FastGithub.Configuration/DomainConfig.cs`

### Domain resolution

- [Domain resolver](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.DomainResolve/DomainResolver.cs): `FastGithub.DomainResolve/DomainResolver.cs`
- [DNS lookup](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.DomainResolve/DnsClient.cs): `FastGithub.DomainResolve/DnsClient.cs`
- [Resolution persistence](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.DomainResolve/PersistenceService.cs): `FastGithub.DomainResolve/PersistenceService.cs`

### Proxy and TLS

- [Outbound HTTP client](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.Http/HttpClient.cs): `FastGithub.Http/HttpClient.cs`
- [Resolved socket connect](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.Http/HttpClientHandler.cs): `FastGithub.Http/HttpClientHandler.cs`
- [HTTP reverse proxy](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.HttpServer/HttpMiddlewares/HttpReverseProxyMiddleware.cs): `FastGithub.HttpServer/HttpMiddlewares/HttpReverseProxyMiddleware.cs`
- [TCP reverse proxy](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.HttpServer/TcpMiddlewares/TcpReverseProxyHandler.cs): `FastGithub.HttpServer/TcpMiddlewares/TcpReverseProxyHandler.cs`
- [Certificate service](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.HttpServer/Certs/CertService.cs): `FastGithub.HttpServer/Certs/CertService.cs`
- [Certificate generator](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.HttpServer/Certs/CertGenerator.cs): `FastGithub.HttpServer/Certs/CertGenerator.cs`

### Packet interception

- [DNS interception](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.PacketIntercept/Dns/DnsInterceptor.cs): `FastGithub.PacketIntercept/Dns/DnsInterceptor.cs`
- [DNS intercept service](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.PacketIntercept/DnsInterceptHostedService.cs): `FastGithub.PacketIntercept/DnsInterceptHostedService.cs`
- [TCP interception](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.PacketIntercept/Tcp/TcpInterceptor.cs): `FastGithub.PacketIntercept/Tcp/TcpInterceptor.cs`

### UI and flow

- [Flow analysis](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.FlowAnalyze/FlowAnalyzer.cs): `FastGithub.FlowAnalyze/FlowAnalyzer.cs`
- [Desktop window](https://github.com/openwrtbuild/fastgithub/blob/test/FastGithub.UI/MainWindow.xaml.cs): `FastGithub.UI/MainWindow.xaml.cs`

### Other components

- **Local client**
- **GitHub and other sites**

## Connections

- Local client → HTTP reverse proxy: proxies through
- Desktop UI → Application host: starts process (evidence: `FastGithub.UI/Program.cs`)
- Application host → App lifecycle: runs lifecycle
- Domain settings → Domain policies: builds policies (evidence: `FastGithub.Configuration/FastGithubConfig.cs`)
- Outbound HTTP client → Resolved socket connect: uses handler (evidence: `FastGithub.Http/HttpClient.cs`)
- Resolved socket connect → Domain resolver: resolves endpoints (evidence: `FastGithub.Http/HttpClientHandler.cs`)
- TCP reverse proxy → Domain resolver: resolves endpoints (evidence: `FastGithub.HttpServer/TcpMiddlewares/TcpReverseProxyHandler.cs`)
- HTTP reverse proxy → Outbound HTTP client: forwards requests
- DNS lookup → Domain settings: reads fallback DNS (evidence: `FastGithub.DomainResolve/DnsClient.cs`)
- Domain resolver → DNS lookup: performs lookups
- Domain resolver → Resolution persistence: persists results
- DNS intercept service → DNS interception: runs interception (evidence: `FastGithub.PacketIntercept/DnsInterceptHostedService.cs`)
- TCP interception → GitHub and other sites: intercepts traffic
- Certificate service → Certificate generator: creates certificates (evidence: `FastGithub.HttpServer/Certs/CertService.cs`)
- HTTP reverse proxy → GitHub and other sites: forwards traffic
- Flow analysis → Desktop window: displays statistics
- Local client → DNS interception: uses DNS interception
- Domain resolver → GitHub and other sites: selects fastest IP
- Domain policies → Resolved socket connect: sets TLS and IP policy (evidence: `FastGithub.Http/HttpClientHandler.cs`)
