# sathwik4444/meshguard architecture

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

- Interactive diagram: https://gitdiagram.com/sathwik4444/meshguard
- Repository: https://github.com/sathwik4444/meshguard

## Overview

MESHGUARD is a Linux DNS-routing and failover installer for clients using Tailscale to reach AdGuard or Pi-hole. The documented workflow is to install and configure the client, then let its daemon probe the DNS endpoint and adjust the local resolver according to the selected mode; users can inspect or change that behavior with the `server` CLI. The README describes these capabilities, but no source excerpts were provided, so relationships below are limited to those documented there.

Main entry points: [`block.sh`](https://github.com/sathwik4444/meshguard/blob/main/block.sh) (server CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Installation"]
  node_installer["Installer<br/>[block.sh]"]
  node_tailscale_setup["Tailscale setup<br/>[block.sh]"]
  node_resolver_snapshot["Resolver snapshot<br/>[block.sh]"]
  node_systemd_service["systemd service<br/>[block.sh]"]
end

subgraph group_runtime["DNS Routing"]
  node_dns_daemon["DNS daemon<br/>[block.sh]"]
  node_health_monitor["Endpoint health monitor<br/>[block.sh]"]
  node_mode_routing["Mode-based routing<br/>[block.sh]"]
  node_linux_resolver["Linux resolver"]
  node_fallback_route["Fallback DNS route"]
  node_tailscale_network["Tailscale network"]
  node_adguard_endpoint["AdGuard DNS endpoint"]
end

subgraph group_admin["Client Administration"]
  node_server_cli["server CLI<br/>[block.sh]"]
  node_status_diagnosis["Status and diagnosis<br/>[block.sh]"]
  node_updates_verification["Update and verification<br/>[block.sh]"]
  node_login_uninstall["Login and uninstall<br/>[block.sh]"]
end

node_user(("Linux administrator"))

node_user -->|"runs"| node_installer
node_installer -->|"configures"| node_tailscale_setup
node_installer -->|"records"| node_resolver_snapshot
node_installer -->|"installs"| node_systemd_service
node_installer -->|"creates"| node_server_cli
node_systemd_service -->|"runs"| node_dns_daemon
node_dns_daemon -->|"performs"| node_health_monitor
node_health_monitor -->|"probes"| node_adguard_endpoint
node_dns_daemon -->|"applies"| node_mode_routing
node_mode_routing -->|"updates route"| node_linux_resolver
node_mode_routing -->|"selects on failure"| node_fallback_route
node_linux_resolver -->|"routes DNS"| node_tailscale_network
node_tailscale_network -->|"reaches"| node_adguard_endpoint
node_user -->|"controls"| node_server_cli
node_server_cli -->|"controls and inspects"| node_dns_daemon
node_server_cli -->|"offers"| node_status_diagnosis
node_server_cli -->|"offers"| node_updates_verification
node_server_cli -->|"offers"| node_login_uninstall

click node_installer "https://github.com/sathwik4444/meshguard/blob/main/block.sh"
click node_tailscale_setup "https://github.com/sathwik4444/meshguard/blob/main/block.sh"
click node_resolver_snapshot "https://github.com/sathwik4444/meshguard/blob/main/block.sh"
click node_systemd_service "https://github.com/sathwik4444/meshguard/blob/main/block.sh"
click node_dns_daemon "https://github.com/sathwik4444/meshguard/blob/main/block.sh"
click node_health_monitor "https://github.com/sathwik4444/meshguard/blob/main/block.sh"
click node_mode_routing "https://github.com/sathwik4444/meshguard/blob/main/block.sh"
click node_server_cli "https://github.com/sathwik4444/meshguard/blob/main/block.sh"
click node_status_diagnosis "https://github.com/sathwik4444/meshguard/blob/main/block.sh"
click node_updates_verification "https://github.com/sathwik4444/meshguard/blob/main/block.sh"
click node_login_uninstall "https://github.com/sathwik4444/meshguard/blob/main/block.sh"

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_installer,node_tailscale_setup,node_resolver_snapshot,node_systemd_service toneBlue
class node_dns_daemon,node_health_monitor,node_mode_routing,node_linux_resolver,node_fallback_route,node_tailscale_network,node_adguard_endpoint toneAmber
class node_server_cli,node_status_diagnosis,node_updates_verification,node_login_uninstall toneMint
class node_user toneIndigo
```

## Components

### Installation

- [Installer](https://github.com/sathwik4444/meshguard/blob/main/block.sh): `block.sh`
- [Tailscale setup](https://github.com/sathwik4444/meshguard/blob/main/block.sh): `block.sh`
- [Resolver snapshot](https://github.com/sathwik4444/meshguard/blob/main/block.sh): `block.sh`
- [systemd service](https://github.com/sathwik4444/meshguard/blob/main/block.sh): `block.sh`

### DNS Routing

- [DNS daemon](https://github.com/sathwik4444/meshguard/blob/main/block.sh): `block.sh`
- [Endpoint health monitor](https://github.com/sathwik4444/meshguard/blob/main/block.sh): `block.sh`
- [Mode-based routing](https://github.com/sathwik4444/meshguard/blob/main/block.sh): `block.sh`
- **Linux resolver**
- **Fallback DNS route**
- **Tailscale network**
- **AdGuard DNS endpoint**

### Client Administration

- [server CLI](https://github.com/sathwik4444/meshguard/blob/main/block.sh): `block.sh`
- [Status and diagnosis](https://github.com/sathwik4444/meshguard/blob/main/block.sh): `block.sh`
- [Update and verification](https://github.com/sathwik4444/meshguard/blob/main/block.sh): `block.sh`
- [Login and uninstall](https://github.com/sathwik4444/meshguard/blob/main/block.sh): `block.sh`

### Other components

- **Linux administrator**

## Connections

- Linux administrator → Installer: runs (evidence: `README.md`)
- Installer → Tailscale setup: configures (evidence: `README.md`)
- Installer → Resolver snapshot: records (evidence: `README.md`)
- Installer → systemd service: installs (evidence: `README.md`)
- Installer → server CLI: creates (evidence: `README.md`)
- systemd service → DNS daemon: runs (evidence: `README.md`)
- DNS daemon → Endpoint health monitor: performs (evidence: `README.md`)
- Endpoint health monitor → AdGuard DNS endpoint: probes (evidence: `README.md`)
- DNS daemon → Mode-based routing: applies (evidence: `README.md`)
- Mode-based routing → Linux resolver: updates route (evidence: `README.md`)
- Mode-based routing → Fallback DNS route: selects on failure (evidence: `README.md`)
- Linux resolver → Tailscale network: routes DNS (evidence: `README.md`)
- Tailscale network → AdGuard DNS endpoint: reaches (evidence: `README.md`)
- Linux administrator → server CLI: controls (evidence: `README.md`)
- server CLI → DNS daemon: controls and inspects (evidence: `README.md`)
- server CLI → Status and diagnosis: offers (evidence: `README.md`)
- server CLI → Update and verification: offers (evidence: `README.md`)
- server CLI → Login and uninstall: offers (evidence: `README.md`)
