# openwrtbuild/fastgithub102 architecture

> Architecture diagram of the GitHub repository openwrtbuild/fastgithub102, 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/fastgithub102
- Repository: https://github.com/openwrtbuild/fastgithub102

## Overview

FastGithub is a GitHub-focused DNS service: it discovers candidate GitHub IPs, scans them for reachability and performance, retains scan results, then answers DNS queries with preferred addresses. Separate hosted jobs perform full scans and rescan known results; the DNS service can also update and restore the machine’s DNS settings on Windows. The graph includes the middleware pipeline and release-check capability. Some wiring is documented only by the README or source index, so unsupported implementation links are omitted.

Main entry points: [`FastGithub.Scanner/GithubScanService.cs`](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/GithubScanService.cs) (Scan coordinator), [`FastGithub.Scanner/GithubLookupFacotry.cs`](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/GithubLookupFacotry.cs) (Lookup factory), [`FastGithub.Scanner/LookupProviders/GithubMetaProvider.cs`](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/LookupProviders/GithubMetaProvider.cs) (GitHub meta lookup), [`FastGithub.Scanner/LookupProviders/PublicDnsProvider.cs`](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/LookupProviders/PublicDnsProvider.cs) (Public DNS lookup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Address discovery"]
  node_lookup_factory["Lookup factory"]
  node_github_meta["GitHub meta lookup"]
  node_public_dns["Public DNS lookup"]
  node_reverse_lookup["IP address lookup"]
  node_domain_address["Domain-address pair<br/>[DomainAddress.cs]"]
end

subgraph group_scanning["Scanning and results"]
  node_scan_jobs["Scan schedules"]
  node_result_job["Result rescan schedule"]
  node_scan_service["Scan coordinator"]
  node_scan_pipeline["Middleware pipeline<br/>[PipelineBuilder.cs]"]
  node_scan_middleware["Scan checks"]
  node_scan_context["Scan context and history<br/>[GithubContext.cs]"]
  node_scan_results[("Reachability results")]
  node_dns_http["DNS HTTP handler"]
end

subgraph group_dns["DNS service"]
  node_dns_server["DNS server host"]
  node_dns_resolver["GitHub query resolver"]
  node_name_service["Machine DNS settings<br/>[NameServiceUtil.cs]"]
end

subgraph group_operations["Runtime operations"]
  node_upgrade_host["Upgrade schedule"]
  node_upgrade_service["Release checker<br/>[UpgradeService.cs]"]
  node_release_data["Release metadata<br/>[GiteeRelease.cs]"]
end

node_client(("DNS client"))
node_gitee["Gitee releases"]

node_client -->|"queries"| node_dns_server
node_dns_server -->|"routes queries"| node_dns_resolver
node_dns_resolver -->|"reads results"| node_scan_results
node_dns_server -->|"sets DNS"| node_name_service
node_scan_jobs -->|"starts full scans"| node_scan_service
node_result_job -->|"starts result scans"| node_scan_service
node_scan_service -->|"requests addresses"| node_lookup_factory
node_scan_service -->|"builds pipelines"| node_scan_pipeline
node_scan_service -->|"configures checks"| node_scan_middleware
node_scan_service -->|"creates contexts"| node_scan_context
node_scan_service -->|"stores and reads results"| node_scan_results
node_github_meta -->|"produces addresses"| node_domain_address
node_public_dns -->|"produces addresses"| node_domain_address
node_lookup_factory -.->|"uses provider"| node_github_meta
node_lookup_factory -.->|"uses provider"| node_public_dns
node_lookup_factory -.->|"uses provider"| node_reverse_lookup
node_github_meta -.->|"fallback data"| node_gitee
node_public_dns -.->|"queries DNS sources"| node_gitee
node_reverse_lookup -.->|"reverse lookup"| node_gitee
node_dns_http -->|"uses results"| node_scan_results
node_upgrade_host -->|"runs check"| node_upgrade_service
node_upgrade_service -->|"fetches releases"| node_gitee
node_upgrade_service -->|"parses release"| node_release_data

click node_lookup_factory "https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/GithubLookupFacotry.cs"
click node_github_meta "https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/LookupProviders/GithubMetaProvider.cs"
click node_public_dns "https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/LookupProviders/PublicDnsProvider.cs"
click node_reverse_lookup "https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/LookupProviders/IPAddressComProvider.cs"
click node_domain_address "https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/DomainAddress.cs"
click node_scan_jobs "https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/GithubFullScanHostedService.cs"
click node_result_job "https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/GithubResultScanHostedService.cs"
click node_scan_service "https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/GithubScanService.cs"
click node_scan_pipeline "https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Core/PipelineBuilder.cs"
click node_scan_middleware "https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/ScanMiddlewares/HttpsScanMiddleware.cs"
click node_scan_context "https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/GithubContext.cs"
click node_scan_results "https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/GithubScanResults.cs"
click node_dns_http "https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/GithubDnsHttpHandler.cs"
click node_dns_server "https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Dns/DnsHostedService.cs"
click node_dns_resolver "https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Dns/GithubRequestResolver.cs"
click node_name_service "https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Dns/NameServiceUtil.cs"
click node_upgrade_host "https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Upgrade/UpgradeHostedService.cs"
click node_upgrade_service "https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Upgrade/UpgradeService.cs"
click node_release_data "https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Upgrade/GiteeRelease.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_lookup_factory,node_github_meta,node_public_dns,node_reverse_lookup,node_domain_address,node_client toneBlue
class node_scan_jobs,node_result_job,node_scan_service,node_scan_pipeline,node_scan_middleware,node_scan_context,node_scan_results,node_dns_http toneAmber
class node_dns_server,node_dns_resolver,node_name_service toneMint
class node_upgrade_host,node_upgrade_service,node_release_data toneRose
class node_gitee toneIndigo
```

## Components

### Address discovery

- [Lookup factory](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/GithubLookupFacotry.cs): `FastGithub.Scanner/GithubLookupFacotry.cs`
- [GitHub meta lookup](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/LookupProviders/GithubMetaProvider.cs): `FastGithub.Scanner/LookupProviders/GithubMetaProvider.cs`
- [Public DNS lookup](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/LookupProviders/PublicDnsProvider.cs): `FastGithub.Scanner/LookupProviders/PublicDnsProvider.cs`
- [IP address lookup](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/LookupProviders/IPAddressComProvider.cs): `FastGithub.Scanner/LookupProviders/IPAddressComProvider.cs`
- [Domain-address pair](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/DomainAddress.cs): `FastGithub.Scanner/DomainAddress.cs`

### Scanning and results

- [Scan schedules](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/GithubFullScanHostedService.cs): `FastGithub.Scanner/GithubFullScanHostedService.cs`
- [Result rescan schedule](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/GithubResultScanHostedService.cs): `FastGithub.Scanner/GithubResultScanHostedService.cs`
- [Scan coordinator](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/GithubScanService.cs): `FastGithub.Scanner/GithubScanService.cs`
- [Middleware pipeline](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Core/PipelineBuilder.cs): `FastGithub.Core/PipelineBuilder.cs`
- [Scan checks](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/ScanMiddlewares/HttpsScanMiddleware.cs): `FastGithub.Scanner/ScanMiddlewares/HttpsScanMiddleware.cs`
- [Scan context and history](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/GithubContext.cs): `FastGithub.Scanner/GithubContext.cs`
- [Reachability results](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/GithubScanResults.cs): `FastGithub.Scanner/GithubScanResults.cs`
- [DNS HTTP handler](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Scanner/GithubDnsHttpHandler.cs): `FastGithub.Scanner/GithubDnsHttpHandler.cs`

### DNS service

- [DNS server host](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Dns/DnsHostedService.cs): `FastGithub.Dns/DnsHostedService.cs`
- [GitHub query resolver](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Dns/GithubRequestResolver.cs): `FastGithub.Dns/GithubRequestResolver.cs`
- [Machine DNS settings](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Dns/NameServiceUtil.cs): `FastGithub.Dns/NameServiceUtil.cs`

### Runtime operations

- [Upgrade schedule](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Upgrade/UpgradeHostedService.cs): `FastGithub.Upgrade/UpgradeHostedService.cs`
- [Release checker](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Upgrade/UpgradeService.cs): `FastGithub.Upgrade/UpgradeService.cs`
- [Release metadata](https://github.com/openwrtbuild/fastgithub102/blob/main/FastGithub.Upgrade/GiteeRelease.cs): `FastGithub.Upgrade/GiteeRelease.cs`

### Other components

- **DNS client**
- **Gitee releases**

## Connections

- DNS client → DNS server host: queries
- DNS server host → GitHub query resolver: routes queries (evidence: `FastGithub.Dns/DnsHostedService.cs`)
- GitHub query resolver → Reachability results: reads results (evidence: `FastGithub.Dns/GithubRequestResolver.cs`)
- DNS server host → Machine DNS settings: sets DNS (evidence: `FastGithub.Dns/DnsHostedService.cs`)
- Scan schedules → Scan coordinator: starts full scans (evidence: `FastGithub.Scanner/GithubFullScanHostedService.cs`)
- Result rescan schedule → Scan coordinator: starts result scans (evidence: `FastGithub.Scanner/GithubResultScanHostedService.cs`)
- Scan coordinator → Lookup factory: requests addresses (evidence: `FastGithub.Scanner/GithubScanService.cs`)
- Scan coordinator → Middleware pipeline: builds pipelines (evidence: `FastGithub.Scanner/GithubScanService.cs`)
- Scan coordinator → Scan checks: configures checks (evidence: `FastGithub.Scanner/GithubScanService.cs`)
- Scan coordinator → Scan context and history: creates contexts (evidence: `FastGithub.Scanner/GithubScanService.cs`)
- Scan coordinator → Reachability results: stores and reads results (evidence: `FastGithub.Scanner/GithubScanService.cs`)
- GitHub meta lookup → Domain-address pair: produces addresses (evidence: `FastGithub.Scanner/LookupProviders/GithubMetaProvider.cs`)
- Public DNS lookup → Domain-address pair: produces addresses (evidence: `FastGithub.Scanner/LookupProviders/PublicDnsProvider.cs`)
- Lookup factory → GitHub meta lookup: uses provider
- Lookup factory → Public DNS lookup: uses provider
- Lookup factory → IP address lookup: uses provider
- GitHub meta lookup → Gitee releases: fallback data
- Public DNS lookup → Gitee releases: queries DNS sources
- IP address lookup → Gitee releases: reverse lookup
- DNS HTTP handler → Reachability results: uses results (evidence: `FastGithub.Scanner/GithubDnsHttpHandler.cs`)
- Upgrade schedule → Release checker: runs check (evidence: `FastGithub.Upgrade/UpgradeHostedService.cs`)
- Release checker → Gitee releases: fetches releases (evidence: `FastGithub.Upgrade/UpgradeService.cs`)
- Release checker → Release metadata: parses release (evidence: `FastGithub.Upgrade/UpgradeService.cs`)
