This directory contains the Zagros multi-user PingTunnel implementation.
It is a Zagros-integrated PingTunnel variant used by the panel runtime, with multi-user authentication, session control, and usage accounting extensions.
This implementation adds database-backed multi-user operation on the server side:
-dbserver flag for auth/usage database path.- User-key validation from DB (enabled users only).
- Quota checks (
used_bytesvsquota_bytes). - Active-session enforcement per user key.
- Session handoff timeout and stale session cleanup.
- Background user reload and traffic flush loops.
- Usage log persistence (
usage_log) and session persistence (active_sessions).
Key code locations:
cmd/main.go:-dbflag andNewServerWithDB(...)server.go: auth-aware server runtime pathauthdb.go: user cache, session control, traffic accounting
The current source and binary in this repo contain multi-user code paths:
- Source evidence:
NewServerWithDBis present and used in server startup.AuthManagerincludes session and usage logic.PINGTUNNEL_USER_RELOAD, session timeout/handoff env controls exist.
- Binary evidence:
- Compiled binary contains strings for:
database path for multi-user auth (server only)PINGTUNNEL_USER_RELOADactive_sessionsuser already has active session
- Compiled binary contains strings for:
The panel uses PostgreSQL as primary control-plane DB.
This PingTunnel variant uses its own SQLite DB for PingTunnel runtime auth/usage
state (via -db), which is synchronized by the panel services.
Do not assume stock upstream behavior for this variant.
Example server startup with database-backed auth:
./pingtunnel -type server -key 123456789 -db /opt/pingtunnel/data.dbUseful environment controls:
PINGTUNNEL_USER_RELOAD(default1s)PINGTUNNEL_SESSION_TIMEOUT(default60s)PINGTUNNEL_SESSION_HANDOFF(default5s)
Build locally:
cd cores/pingtunnel/cmd
go build -v -o ../pingtunnelUpstream project license is MIT and must be preserved.
For this distribution:
- Keep upstream MIT license text intact.
- Retain this notice in README/NOTICE when redistributing this modified build.
- Retain a visible attribution to this repository in redistributed source/binaries.
- Attribution to retain:
Refactored multi-user PingTunnel by Zagros UISource: https://github.com/MeXenon/PingTunnel-Multi
This keeps upstream license obligations intact while making origin explicit.
Important:
- You cannot remove upstream MIT rights from upstream code.
- You can require preserving attribution for this redistributed modified package by keeping this README and NOTICE in distribution artifacts.