# evsio0n/nylon architecture

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

- Interactive diagram: https://gitdiagram.com/evsio0n/nylon
- Repository: https://github.com/evsio0n/nylon

## Overview

Nylon is a WireGuard-based resilient overlay VPN that combines dynamic Babel-like routing with user-space packet forwarding. The main workflow is to start a node with its configuration, establish encrypted peer links, exchange in-band route updates, select routes around outages, and forward traffic through the overlay. The tree also shows configuration distribution, passive WireGuard-client support, platform and mobile interfaces, and a web UI. README claims guide these capability branches; source excerpts are partial, so uncertain internal wiring is omitted.

Main entry points: [`core/control_plane.go`](https://github.com/evsio0n/nylon/blob/main/core/control_plane.go) (Control plane), [`core/entrypoint.go`](https://github.com/evsio0n/nylon/blob/main/core/entrypoint.go) (Runtime entrypoint), [`core/router.go`](https://github.com/evsio0n/nylon/blob/main/core/router.go) (Router runtime), [`polyamide/device/device.go`](https://github.com/evsio0n/nylon/blob/main/polyamide/device/device.go) (WireGuard device)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_cli["CLI commands<br/>[root.go]"]
  node_mobile["Mobile API<br/>[api.go]"]
  node_mobile_routes["Mobile routes<br/>[routes.go]"]
  node_web_ui["Web UI<br/>[app.js]"]
end

subgraph group_control["Node control"]
  node_entrypoint["Runtime entrypoint<br/>[entrypoint.go]"]
  node_state_config["Node configuration<br/>[config.go]"]
  node_state["Runtime state<br/>[state.go]"]
  node_control_plane["Control plane<br/>[control_plane.go]"]
  node_distribution["Config distribution"]
  node_passive["Passive clients<br/>[nylon_passive.go]"]
  node_system["System networking<br/>[sys.go]"]
end

subgraph group_routing["Overlay routing"]
  node_router["Router runtime<br/>[router.go]"]
  node_router_algo["Route selection<br/>[router_algo.go]"]
  node_routing_state["Routing state<br/>[routing.go]"]
  node_endpoints["Endpoint management<br/>[nylon_endpoints.go]"]
end

subgraph group_transport["Secure transport"]
  node_nylon["Overlay runtime<br/>[nylon.go]"]
  node_poly_device["WireGuard device<br/>[device.go]"]
  node_tun["TUN interface<br/>[tun.go]"]
end

node_operator(("Operator"))
node_peer_network(("Overlay peers"))
node_physical_network(("Physical network"))

node_operator -->|"runs"| node_cli
node_cli -->|"starts"| node_entrypoint
node_entrypoint -->|"loads"| node_state_config
node_entrypoint -->|"initializes"| node_state
node_entrypoint -->|"starts"| node_control_plane
node_control_plane -->|"coordinates"| node_distribution
node_control_plane -->|"coordinates"| node_passive
node_control_plane -->|"starts"| node_router
node_control_plane -->|"starts"| node_nylon
node_control_plane -->|"configures"| node_system
node_distribution -.->|"fetches configuration"| node_physical_network
node_passive -->|"supports clients"| node_poly_device
node_router -->|"handles routing"| node_router_algo
node_router_algo -->|"updates"| node_routing_state
node_router -->|"sends route messages"| node_nylon
node_nylon -->|"transports packets"| node_poly_device
node_poly_device -->|"reads and writes"| node_tun
node_poly_device -->|"sends encrypted traffic"| node_physical_network
node_physical_network -->|"connects"| node_peer_network
node_router -->|"uses endpoints"| node_endpoints
node_mobile -->|"dispatches state work"| node_state
node_mobile_routes -->|"reads routes"| node_state
node_web_ui -->|"requests status"| node_control_plane

click node_cli "https://github.com/evsio0n/nylon/blob/main/cmd/root.go"
click node_mobile "https://github.com/evsio0n/nylon/blob/main/mobile/api.go"
click node_mobile_routes "https://github.com/evsio0n/nylon/blob/main/mobile/routes.go"
click node_web_ui "https://github.com/evsio0n/nylon/blob/main/core/ui/app.js"
click node_entrypoint "https://github.com/evsio0n/nylon/blob/main/core/entrypoint.go"
click node_state_config "https://github.com/evsio0n/nylon/blob/main/state/config.go"
click node_state "https://github.com/evsio0n/nylon/blob/main/state/state.go"
click node_control_plane "https://github.com/evsio0n/nylon/blob/main/core/control_plane.go"
click node_distribution "https://github.com/evsio0n/nylon/blob/main/core/nylon_distribution.go"
click node_passive "https://github.com/evsio0n/nylon/blob/main/core/nylon_passive.go"
click node_system "https://github.com/evsio0n/nylon/blob/main/core/sys.go"
click node_router "https://github.com/evsio0n/nylon/blob/main/core/router.go"
click node_router_algo "https://github.com/evsio0n/nylon/blob/main/core/router_algo.go"
click node_routing_state "https://github.com/evsio0n/nylon/blob/main/state/routing.go"
click node_endpoints "https://github.com/evsio0n/nylon/blob/main/core/nylon_endpoints.go"
click node_nylon "https://github.com/evsio0n/nylon/blob/main/core/nylon.go"
click node_poly_device "https://github.com/evsio0n/nylon/blob/main/polyamide/device/device.go"
click node_tun "https://github.com/evsio0n/nylon/blob/main/polyamide/tun/tun.go"

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_cli,node_mobile,node_mobile_routes,node_web_ui toneBlue
class node_entrypoint,node_state_config,node_state,node_control_plane,node_distribution,node_passive,node_system toneAmber
class node_router,node_router_algo,node_routing_state,node_endpoints toneMint
class node_nylon,node_poly_device,node_tun toneRose
class node_operator,node_peer_network,node_physical_network toneIndigo
```

## Components

### User interfaces

- [CLI commands](https://github.com/evsio0n/nylon/blob/main/cmd/root.go): `cmd/root.go`
- [Mobile API](https://github.com/evsio0n/nylon/blob/main/mobile/api.go): `mobile/api.go`
- [Mobile routes](https://github.com/evsio0n/nylon/blob/main/mobile/routes.go): `mobile/routes.go`
- [Web UI](https://github.com/evsio0n/nylon/blob/main/core/ui/app.js): `core/ui/app.js`

### Node control

- [Runtime entrypoint](https://github.com/evsio0n/nylon/blob/main/core/entrypoint.go): `core/entrypoint.go`
- [Node configuration](https://github.com/evsio0n/nylon/blob/main/state/config.go): `state/config.go`
- [Runtime state](https://github.com/evsio0n/nylon/blob/main/state/state.go): `state/state.go`
- [Control plane](https://github.com/evsio0n/nylon/blob/main/core/control_plane.go): `core/control_plane.go`
- [Config distribution](https://github.com/evsio0n/nylon/blob/main/core/nylon_distribution.go): `core/nylon_distribution.go`
- [Passive clients](https://github.com/evsio0n/nylon/blob/main/core/nylon_passive.go): `core/nylon_passive.go`
- [System networking](https://github.com/evsio0n/nylon/blob/main/core/sys.go): `core/sys.go`

### Overlay routing

- [Router runtime](https://github.com/evsio0n/nylon/blob/main/core/router.go): `core/router.go`
- [Route selection](https://github.com/evsio0n/nylon/blob/main/core/router_algo.go): `core/router_algo.go`
- [Routing state](https://github.com/evsio0n/nylon/blob/main/state/routing.go): `state/routing.go`
- [Endpoint management](https://github.com/evsio0n/nylon/blob/main/core/nylon_endpoints.go): `core/nylon_endpoints.go`

### Secure transport

- [Overlay runtime](https://github.com/evsio0n/nylon/blob/main/core/nylon.go): `core/nylon.go`
- [WireGuard device](https://github.com/evsio0n/nylon/blob/main/polyamide/device/device.go): `polyamide/device/device.go`
- [TUN interface](https://github.com/evsio0n/nylon/blob/main/polyamide/tun/tun.go): `polyamide/tun/tun.go`

### Other components

- **Operator**
- **Overlay peers**
- **Physical network**

## Connections

- Operator → CLI commands: runs
- CLI commands → Runtime entrypoint: starts
- Runtime entrypoint → Node configuration: loads
- Runtime entrypoint → Runtime state: initializes
- Runtime entrypoint → Control plane: starts
- Control plane → Config distribution: coordinates
- Control plane → Passive clients: coordinates
- Control plane → Router runtime: starts
- Control plane → Overlay runtime: starts
- Control plane → System networking: configures
- Config distribution → Physical network: fetches configuration
- Passive clients → WireGuard device: supports clients
- Router runtime → Route selection: handles routing
- Route selection → Routing state: updates
- Router runtime → Overlay runtime: sends route messages
- Overlay runtime → WireGuard device: transports packets
- WireGuard device → TUN interface: reads and writes
- WireGuard device → Physical network: sends encrypted traffic
- Physical network → Overlay peers: connects
- Router runtime → Endpoint management: uses endpoints
- Mobile API → Runtime state: dispatches state work
- Mobile routes → Runtime state: reads routes
- Web UI → Control plane: requests status
