识别准确度(debug7) - 可选接入 sing-box Clash API:按来源终端 + 域名 + 字节记账,代理隧道与 FakeIP 流量不重复计算;未接入时代理机器流量标为旁路代理隧道 - 可选接入 MosDNS 审计日志:终端 + IP → 域名 - 地址与密钥由用户在 系统设置 → 外部数据源 填写(或环境变量),不填不启用 - IP→ASN 库(iptoasn.com,PDDL,运行时每天下载),无域名流量按归属识别;实时连接 / 访问目标显示归属与国家 - 健康指数新增旁路代理提示;概览应用数区分今日出现与规则库总数 识别库自动更新(debug8) - 每天检查 v2fly 最新提交,下载转换后自检(抽样域名、应用数),通过后热加载,失败保留旧库 - 识别规则页新增识别库面板(来源、版本、规模、许可证、检查结果、自动更新开关) - 转换逻辑移到 app/classify/v2fly.py,生成文件记录来源提交 布局审计 - 手机上表格隐藏次要列、名称下补充关键信息;子标签横向滑动;统计卡改为卡片样式;平板断点调整 - 系统设置拆为四个子标签;识别规则页整理;重复名称只显示一次;少量数据点的折线显示数据点 - 测试环境不启动后台定时任务,修复整点落库导致的偶发失败 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6.5 KiB
6.5 KiB
ROS-DPI
RouterOS 终端流量与应用统计面板。按 今日 / 本周 / 本月 统计每台终端的流量和应用使用情况,类似 Panabit / 碧海威。
Per-device traffic and per-application (DPI-style) statistics for MikroTik RouterOS, built on IPFIX + DNS sniffing.
Source & docs: https://github.com/suyijun8182/ros-dpi
What's new
- 0.3.0: optional sing-box Clash API and MosDNS integration (per-device proxied traffic and DNS), IP→ASN identification (iptoasn.com, public domain), daily self-tested auto-update of the v2fly rules, RouterOS rule self-check, page-by-page layout fixes for desktop / tablet / phone. Also includes 0.2.1: charts restyled after WayOS 4.0 (solid pie with paged legend, traffic card with live / history / online tabs, upright up/down lines); WAN rate sampled every 5 seconds for the live chart; the Flows page is now live connections plus top destinations (the Sankey diagram is gone).
- 0.2.0: redesigned UI after WayOS 4.0 (sidebar layout, new "seven layers" logo, new login page); dashboard with network health score, DHCP pools, WAN line status and online-host history; session time and connection count per host; DHCP lease list; live per-app rates; top-bar search; CSV export. Also includes: 2800+ apps / ~38k domains (adds v2fly/domain-list-community, MIT); per-connection SNI identification from TLS ClientHello and decrypted QUIC Initial packets (v1/v2), so apps are identified even with DoH and on shared CDN IPs; domain-source breakdown in Settings.
- 0.1.4: Panabit-style three-level app library (10 groups, 41 categories, 277 apps; CDN attribution via CNAME); redesigned charts (traffic-mix donut, trend stacked by app group, ranked lists, Sankey by group); name hosts by MAC or IP; DNS sniffer card shows which DNS servers answers come from.
- 0.1.3: fix the 500 error on the overview page when the RouterOS API (
ROS_URL) is configured; clearer RouterOS connection errors. - 0.1.2: first-run setup wizard: enter your MySQL connection in the browser, like EasySub. The compose file no longer needs database settings. A README guide covers creating the database.
- 0.1.1: full
docker-compose.ymlon this page (no.envneeded), first-run notes, database auto-created on external MySQL. - 0.1.0: first release. Overview, hosts, applications, flow Sankey, custom rules, setup guide. zh/en, light/dark.
Features
- IPFIX / NetFlow v9 collector (udp/2055), TZSP sniffer for DNS answers and TLS/QUIC handshakes (udp/37008), optional read-only RouterOS REST polling
- 2800+ built-in apps in 43 categories under 10 app groups (Panabit-style; ~2500 from v2fly/domain-list-community, MIT); custom domain / CIDR / port rules
- Per-connection SNI from TLS and QUIC handshakes mirrored via TZSP
- Name hosts by MAC or by IP
- Per-minute / hour / day aggregation in MySQL
Quick start
ROS-DPI stores data in MySQL 5.7 / 8.x and assumes you already have one. 默认使用你已有的 MySQL。
1. Create the database and user / 准备数据库(在你的 MySQL 里执行)
CREATE DATABASE rosdpi CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'rosdpi'@'%' IDENTIFIED BY 'your-password';
GRANT ALL PRIVILEGES ON rosdpi.* TO 'rosdpi'@'%';
FLUSH PRIVILEGES;
2. docker-compose.yml: set LAN_CIDRS, then docker compose up -d. 把 LAN_CIDRS 改成你的内网网段后启动。
# ROS-DPI:RouterOS 终端流量与应用统计
# 前提:已有 MySQL 5.7+ / 8.x,并已按 README「准备数据库」建好库和账号
# 用法:保存为 docker-compose.yml,把 LAN_CIDRS 改成你的内网网段,然后 docker compose up -d
# 浏览器打开 http://<本机IP>:8080,按安装向导填写 MySQL 信息、设置管理员密码
services:
ros-dpi:
image: suyijun8182/ros-dpi:latest # 也可用 ghcr.io/suyijun8182/ros-dpi:latest
container_name: ros-dpi
restart: unless-stopped
ports:
- "8080:8080/tcp" # Web 界面
- "2055:2055/udp" # IPFIX / NetFlow:RouterOS Traffic Flow 发到这里
- "37008:37008/udp" # TZSP:RouterOS 镜像的 DNS 应答和 HTTPS/QUIC 握手包发到这里
environment:
TZ: Asia/Shanghai
# MySQL 连接信息在首次打开网页时填写(保存在 ./data/db_config.json)
# 「必改」内网网段,逗号分隔(之后也可在 系统设置 → 网络 里改)
LAN_CIDRS: 192.168.88.0/24
# 管理员 admin 的初始密码;留空则首次打开网页时设置
ADMIN_PASSWORD: ""
# RouterOS 只读 API(可选:显示主机名、WAN 速率)
ROS_URL: "" # 例如 https://192.168.88.1
ROS_USER: ""
ROS_PASSWORD: ""
ROS_VERIFY_TLS: "false"
volumes:
- ./data:/app/data # 保存数据库连接配置,务必保留这个卷
No MySQL yet? / 还没有 MySQL? Use docker-compose.with-mysql.yml. It starts MySQL 8.4 too and is pre-configured, so the database step is skipped. 这个文件会同时启动 MySQL 并且已配置好连接,不需要建库,也不需要在网页上填写。
First run / 首次使用
Open http://<host>:8080. The setup wizard has two steps. 打开网页后按两步完成:
- Connect MySQL / 连接数据库: host, port, user, password, database, with a connection test. Tables are created automatically, and the connection is saved to
./data/db_config.json. If MySQL runs on the same machine, use its LAN IP, not127.0.0.1. 填写 MySQL 信息,可先测试连接;MySQL 在本机时填局域网 IP,不要填 127.0.0.1。 - Create admin / 设置管理员密码.
- Change database later: delete
./data/db_config.jsonand restart. 更换数据库:删除该文件后重启容器。 - Setting
DATABASE_URLskips the wizard. 设置环境变量DATABASE_URL可跳过向导。 - RouterOS commands: Settings → Setup guide. Full guide: https://github.com/suyijun8182/ros-dpi
Ports
| Port | Use |
|---|---|
| 8080/tcp | Web UI |
| 2055/udp | IPFIX / NetFlow v9 |
| 37008/udp | TZSP (DNS answers + TLS/QUIC handshakes) |
Environment
| Variable | Default | Description |
|---|---|---|
DATABASE_URL |
set in compose | mysql+pymysql://user:pass@host:3306/rosdpi?charset=utf8mb4 |
LAN_CIDRS |
private ranges | LAN ranges, comma separated |
ADMIN_PASSWORD |
empty | initial password for admin |
ROS_URL / ROS_USER / ROS_PASSWORD |
empty | RouterOS REST + read-only user |
TZ |
Asia/Shanghai |
statistics time zone (weeks start Monday) |