# tobychui/zoraxy architecture

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

- Interactive diagram: https://gitdiagram.com/tobychui/zoraxy
- Repository: https://github.com/tobychui/zoraxy

## Overview

##### Main Components Identification

The system should be divided into these major components:

a) Core Proxy Services:
- Dynamic Proxy (HTTP/2)
- Stream Proxy (TCP/UDP)
- WebSocket Proxy
- Forward Proxy
- Reverse Proxy

b) Security Layer:
- Authentication System
- Access Control (Blacklist/Whitelist)
- TLS/SSL Management (ACME)
- GeoIP Filtering

c) Management Interface:
- Web UI
- API Endpoints
- Configuration Management

d) Additional Services:
- Web SSH Terminal
- Network Utilities
- Monitoring System
- Global Area Network Controller

**[Client Requests] → [Load Balancer/Entry Point]**
- ↓
**[Security Layer: Auth, ACL, GeoIP]**
- ↓
**[Core Proxy Services] ←→ [Configuration Management]**
- ↓                        ↑
**[Backend Services] ←→ [Monitoring & Analytics]**

##### Specific Implementation Details

Key relationships:
- ACME certificate management with DNS providers
- WebSocket automatic protocol upgrade
- Authentication flow with external systems
- Load balancing and routing mechanisms
- Monitoring and analytics data flow

##### Important Architectural Patterns to Highlight

- Modular design (evident from the /mod directory structure)
- Plugin architecture for various proxy types
- Middleware pattern for request processing
- Event-driven architecture for monitoring

##### Technical Stack Indicators

- Go runtime
- HTTP/2 support
- WebSocket protocol
- TCP/UDP protocols
- ZeroTier integration
- ACME/Let's Encrypt

##### Integration Points

Connections with:
- External DNS providers
- Authentication systems
- Backend services
- Monitoring systems
- ZeroTier network

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        C[Client Requests]
    end

    subgraph "Entry Layer"
        LB[Load Balancer/Entry Point]
    end

    subgraph "Security Layer"
        Auth["Authentication System"]:::security
        ACL["Access Control"]:::security
        GeoIP["GeoIP Filtering"]:::security
        TLS["TLS/SSL Management"]:::security
    end

    subgraph "Core Proxy Services"
        DP["Dynamic Proxy (HTTP/2)"]:::core
        SP["Stream Proxy (TCP/UDP)"]:::core
        WSP["WebSocket Proxy"]:::core
        FP["Forward Proxy"]:::core
        RP["Reverse Proxy"]:::core
    end

    subgraph "Management Layer"
        WUI["Web UI"]:::mgmt
        API["API Endpoints"]:::mgmt
        CM["Configuration Management"]:::mgmt
    end

    subgraph "Additional Services"
        SSH["Web SSH Terminal"]:::additional
        NET["Network Utilities"]:::additional
        MON["Monitoring System"]:::additional
        GAN["Global Area Network Controller"]:::additional
    end

    subgraph "External Systems"
        BS["Backend Services"]:::external
        DNS["DNS Providers"]:::external
        ZT["ZeroTier Network"]:::external
    end

    C --> LB
    LB --> Auth
    Auth --> ACL
    ACL --> GeoIP
    GeoIP --> TLS

    TLS --> DP
    TLS --> SP
    TLS --> WSP
    TLS --> FP
    TLS --> RP

    DP --> BS
    SP --> BS
    WSP --> BS
    FP --> BS
    RP --> BS

    CM --> DP
    CM --> SP
    CM --> WSP
    CM --> FP
    CM --> RP

    MON --> DP
    MON --> SP
    MON --> WSP
    MON --> FP
    MON --> RP

    TLS <--> DNS
    GAN <--> ZT

    WUI --> CM
    API --> CM

    classDef core fill:#2374ab
    classDef security fill:#47a025
    classDef mgmt fill:#ff8c42
    classDef additional fill:#9381ff
    classDef external fill:#gray

    click DP "https://github.com/tobychui/zoraxy/tree/main/src/mod/dynamicproxy/"
    click SP "https://github.com/tobychui/zoraxy/tree/main/src/mod/streamproxy/"
    click WSP "https://github.com/tobychui/zoraxy/tree/main/src/mod/websocketproxy/"
    click FP "https://github.com/tobychui/zoraxy/tree/main/src/mod/forwardproxy/"
    click RP "https://github.com/tobychui/zoraxy/tree/main/src/mod/reverseproxy/"
    click Auth "https://github.com/tobychui/zoraxy/tree/main/src/mod/auth/"
    click ACL "https://github.com/tobychui/zoraxy/tree/main/src/mod/access/"
    click TLS "https://github.com/tobychui/zoraxy/tree/main/src/mod/acme/"
    click GeoIP "https://github.com/tobychui/zoraxy/tree/main/src/mod/geodb/"
    click WUI "https://github.com/tobychui/zoraxy/tree/main/src/web/"
    click API "https://github.com/tobychui/zoraxy/blob/main/src/api.go"
    click SSH "https://github.com/tobychui/zoraxy/tree/main/src/mod/sshprox/"
    click NET "https://github.com/tobychui/zoraxy/tree/main/src/mod/netutils/"
    click MON "https://github.com/tobychui/zoraxy/tree/main/src/mod/statistic/"
    click GAN "https://github.com/tobychui/zoraxy/tree/main/src/mod/ganserv/"
```
