# hicool-ml/pppoe-activation architecture

> Architecture diagram of the GitHub repository hicool-ml/pppoe-activation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hicool-ml/pppoe-activation
- Repository: https://github.com/hicool-ml/pppoe-activation

## Overview

PPPOE 激活系统为用户提供拨号激活，同时包含管理员控制台和首次部署配置界面。核心路径是用户提交 ISP 与账号信息，主应用选择并锁定可用接口、设置 MAC、调用 pppd，并记录结果；管理员可查询日志、管理账号和网络配置。README 还明确记录 VLAN、多 ISP、持久化及备份恢复能力。未展示 init_config.py、网络配置和多个后台路由的源码细节，因此仅保留文档或索引能够支持的关系。

Main entry points: [`models.py`](https://github.com/hicool-ml/pppoe-activation/blob/main/models.py) (数据模型), [`app.py`](https://github.com/hicool-ml/pppoe-activation/blob/main/app.py) (激活服务), [`dashboard.py`](https://github.com/hicool-ml/pppoe-activation/blob/main/dashboard.py) (管理后台), [`sync.py`](https://github.com/hicool-ml/pppoe-activation/blob/main/sync.py) (日志同步)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_activation["用户激活"]
  node_activation_app["激活服务<br/>[app.py]"]
  node_activation_validation["请求校验<br/>[activate.py]"]
  node_activation_log["拨号日志<br/>[app.py]"]
end

subgraph group_network["拨号网络"]
  node_interface_prep["物理与 VLAN 接口<br/>[interface.py]"]
  node_interface_allocation["接口选择与锁<br/>[app.py]"]
  node_pppoe_dialer["PPPoE 拨号<br/>[app.py]"]
end

subgraph group_admin["管理与配置"]
  node_admin_console["管理后台<br/>[dashboard.py]"]
  node_admin_account_ops["管理员账户管理<br/>[dashboard.py]"]
  node_config_service["初始化配置服务<br/>[init_config.py]"]
  node_network_settings["网络配置管理<br/>[dashboard.py]"]
end

subgraph group_persistence["持久化"]
  node_data_models["数据模型<br/>[models.py]"]
  node_sqlite_store[("SQLite 数据库<br/>[models.py]")]
  node_log_sync["日志同步<br/>[sync.py]"]
  node_runtime_config["运行配置<br/>[config.py]"]
end

node_user(("激活用户"))
node_admin_user(("管理员"))
node_config_actor(("部署管理员"))

node_user -->|"提交激活"| node_activation_app
node_activation_app -.->|"校验请求"| node_activation_validation
node_activation_app -->|"选择并锁定"| node_interface_allocation
node_activation_app -->|"调用拨号"| node_pppoe_dialer
node_pppoe_dialer -->|"记录结果"| node_activation_log
node_activation_app -->|"写入日志"| node_data_models
node_activation_app -->|"保存激活记录"| node_sqlite_store
node_admin_user -->|"访问后台"| node_admin_console
node_admin_console -->|"查询与更新"| node_data_models
node_admin_console -->|"调用同步"| node_log_sync
node_admin_account_ops -->|"管理账户"| node_data_models
node_config_actor -->|"配置系统"| node_config_service
node_config_service -->|"使用数据模型"| node_data_models
node_network_settings -->|"读写配置"| node_data_models
node_log_sync -->|"导入日志"| node_data_models
node_log_sync -->|"去重后写入"| node_sqlite_store
node_data_models -->|"读取数据库路径"| node_runtime_config
node_network_settings -.->|"准备 VLAN 接口"| node_interface_prep

click node_activation_app "https://github.com/hicool-ml/pppoe-activation/blob/main/app.py"
click node_activation_validation "https://github.com/hicool-ml/pppoe-activation/blob/main/validators/activate.py"
click node_activation_log "https://github.com/hicool-ml/pppoe-activation/blob/main/app.py"
click node_admin_console "https://github.com/hicool-ml/pppoe-activation/blob/main/dashboard.py"
click node_admin_account_ops "https://github.com/hicool-ml/pppoe-activation/blob/main/dashboard.py"
click node_config_service "https://github.com/hicool-ml/pppoe-activation/blob/main/init_config.py"
click node_network_settings "https://github.com/hicool-ml/pppoe-activation/blob/main/dashboard.py"
click node_interface_prep "https://github.com/hicool-ml/pppoe-activation/blob/main/network/interface.py"
click node_interface_allocation "https://github.com/hicool-ml/pppoe-activation/blob/main/app.py"
click node_pppoe_dialer "https://github.com/hicool-ml/pppoe-activation/blob/main/app.py"
click node_data_models "https://github.com/hicool-ml/pppoe-activation/blob/main/models.py"
click node_sqlite_store "https://github.com/hicool-ml/pppoe-activation/blob/main/models.py"
click node_log_sync "https://github.com/hicool-ml/pppoe-activation/blob/main/sync.py"
click node_runtime_config "https://github.com/hicool-ml/pppoe-activation/blob/main/config.py"

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_activation_app,node_activation_validation,node_activation_log toneBlue
class node_interface_prep,node_interface_allocation,node_pppoe_dialer toneAmber
class node_admin_console,node_admin_account_ops,node_config_service,node_network_settings toneMint
class node_data_models,node_sqlite_store,node_log_sync,node_runtime_config toneRose
class node_user,node_admin_user,node_config_actor toneIndigo
```

## Components

### 用户激活

- [激活服务](https://github.com/hicool-ml/pppoe-activation/blob/main/app.py): `app.py`
- [请求校验](https://github.com/hicool-ml/pppoe-activation/blob/main/validators/activate.py): `validators/activate.py`
- [拨号日志](https://github.com/hicool-ml/pppoe-activation/blob/main/app.py): `app.py`

### 拨号网络

- [物理与 VLAN 接口](https://github.com/hicool-ml/pppoe-activation/blob/main/network/interface.py): `network/interface.py`
- [接口选择与锁](https://github.com/hicool-ml/pppoe-activation/blob/main/app.py): `app.py`
- [PPPoE 拨号](https://github.com/hicool-ml/pppoe-activation/blob/main/app.py): `app.py`

### 管理与配置

- [管理后台](https://github.com/hicool-ml/pppoe-activation/blob/main/dashboard.py): `dashboard.py`
- [管理员账户管理](https://github.com/hicool-ml/pppoe-activation/blob/main/dashboard.py): `dashboard.py`
- [初始化配置服务](https://github.com/hicool-ml/pppoe-activation/blob/main/init_config.py): `init_config.py`
- [网络配置管理](https://github.com/hicool-ml/pppoe-activation/blob/main/dashboard.py): `dashboard.py`

### 持久化

- [数据模型](https://github.com/hicool-ml/pppoe-activation/blob/main/models.py): `models.py`
- [SQLite 数据库](https://github.com/hicool-ml/pppoe-activation/blob/main/models.py): `models.py`
- [日志同步](https://github.com/hicool-ml/pppoe-activation/blob/main/sync.py): `sync.py`
- [运行配置](https://github.com/hicool-ml/pppoe-activation/blob/main/config.py): `config.py`

### Other components

- **激活用户**
- **管理员**
- **部署管理员**

## Connections

- 激活用户 → 激活服务: 提交激活 (evidence: `README.md`)
- 激活服务 → 请求校验: 校验请求
- 激活服务 → 接口选择与锁: 选择并锁定 (evidence: `app.py`)
- 激活服务 → PPPoE 拨号: 调用拨号 (evidence: `app.py`)
- PPPoE 拨号 → 拨号日志: 记录结果 (evidence: `app.py`)
- 激活服务 → 数据模型: 写入日志 (evidence: `app.py`)
- 激活服务 → SQLite 数据库: 保存激活记录 (evidence: `app.py`)
- 管理员 → 管理后台: 访问后台 (evidence: `README.md`)
- 管理后台 → 数据模型: 查询与更新 (evidence: `dashboard.py`)
- 管理后台 → 日志同步: 调用同步 (evidence: `dashboard.py`)
- 管理员账户管理 → 数据模型: 管理账户 (evidence: `dashboard.py`)
- 部署管理员 → 初始化配置服务: 配置系统 (evidence: `README.md`)
- 初始化配置服务 → 数据模型: 使用数据模型 (evidence: `init_config.py`)
- 网络配置管理 → 数据模型: 读写配置 (evidence: `dashboard.py`)
- 日志同步 → 数据模型: 导入日志 (evidence: `sync.py`)
- 日志同步 → SQLite 数据库: 去重后写入 (evidence: `sync.py`)
- 数据模型 → 运行配置: 读取数据库路径 (evidence: `models.py`)
- 网络配置管理 → 物理与 VLAN 接口: 准备 VLAN 接口
