Closes HIF-4 Stage 2 交付:人工奖领奖工单完整闭环。crypto / physical / manual_other 三类奖品从抽中到 mark-paid 的全流程可用。 - 迁移 02159_lottery_claim:UNIQUE(draw_id) + 3 支持索引,状态机 pending_claim→reviewing→paying→paid,rejected 可复活,超时 expired - 3 个 PrizeHandler:Dispatch→ErrDispatchNotSupported 兜底、ClaimSchema 各自形态、ValidateClaim 表驱动 - BuildCryptoClaimSchema:抽中时按奖品 config.networks 注入 enum,前端下拉直接可用 - Draw service dispatchOrEnqueueClaim:人工奖同 tx 插 pending_claim(回滚双清),nonce 重放回读 ExpiresAt + ClaimFormSchema - POST /claim 实装:ownership 校验 → prize 类型校验 → handler.ValidateClaim → crypto network 白名单二次校验 → tx CAS status IN (pending_claim, rejected) AND expires_at > now - Admin CRUD 5 接口:list(IN 批拉 snap + user,无 N+1)、summary(GROUP BY 一次拿计数 + overdue 单查)、approve/reject/mark-paid 全走 CAS + audit - Scheduler @every 1h 扫过期,级联 lottery_draw.dispatch_state → expired - 新增错误码 100005-100011(already_submitted / invalid_claim_data / draw_not_found / not_your_draw / claim_expired / claim_state_invalid) - Rebase 后 Stage 2 测试主动 reuse PR E 的 unmetReasonsNotEmpty + evaluatedAtNotZero matcher,人工奖分支若绕过守卫会立即挂 - Stage 1 全部 4 处 guardrail 后端 rebase 时自检过:UnmetReasons、EvaluatedAt、GrantLedger.Payload、AdminMetaMiddleware 全保留 CI 全绿;28 files, +2442/-126;覆盖率 handler 78.9% / model.lottery 74.3% / draw 68.7% / queue/lottery 76.9%
TawCorp hifast-server (internal fork)
This repository is the canonical TawCorp fork of perfect-panel/server. Migrated from
git.kxsw.us/HI-VPN/hi-serveron 2026-06-03; the old Gitea remote is deprecated — do not push or pull from it.
- Development workflow (required reading for internal contributors):
doc/development-workflow-zh.md- Branch model:
internal(dev mainline, auto-deploys to staging) →main(release)- Merge policy: PR + architect review + GitHub UI "Squash and merge"; direct push to
internal/mainis blocked bylefthookpre-push and forbidden by policy- Issue tracker: Multica workspace
Hifast(prefixHIF-)External contributors: read
CONTRIBUTING.mdfor the upstream-compatible baseline.
PPanel Server
PPanel is a pure, professional, and perfect open-source proxy panel tool, designed for learning and practical use.
English | 中文 | Report Bug | Request Feature
Article 1.
All human beings are born free and equal in dignity and rights.
They are endowed with reason and conscience and should act towards one another in a spirit of brotherhood.Article 12.
No one shall be subjected to arbitrary interference with his privacy, family, home or correspondence, nor to attacks upon his honour and reputation.
Everyone has the right to the protection of the law against such interference or attacks.Article 19.
Everyone has the right to freedom of opinion and expression; this right includes freedom to hold opinions without interference and to seek, receive and impart information and ideas through any media and regardless of frontiers.Source: United Nations – Universal Declaration of Human Rights (UN.org)
📋 Overview
PPanel Server is the backend component of the PPanel project, providing robust APIs and core functionality for managing proxy services. Built with Go, it emphasizes performance, security, and scalability.
Key Features
- Multi-Protocol Support: Supports Shadowsocks, V2Ray, Trojan, and more.
- Privacy First: No user logs are collected, ensuring privacy and security.
- Minimalist Design: Simple yet powerful, with complete business logic.
- User Management: Full authentication and authorization system.
- Subscription System: Manage user subscriptions and service provisioning.
- Payment Integration: Supports multiple payment gateways.
- Order Management: Track and process user orders.
- Ticket System: Built-in customer support and issue tracking.
- Node Management: Monitor and control server nodes.
- API Framework: Comprehensive RESTful APIs for frontend integration.
Subscription Mode Behavior
The subscription behavior can be switched by the backend config Subscribe.SingleModel:
false(multi-subscription mode): each successfulpurchasecreates a newuser_subscriberecord.true(single-subscription mode):purchaseis auto-routed to renewal semantics when the user already has a paid subscription:- a new order is still created,
- but the existing subscription is extended (instead of creating another
user_subscribe).
🚀 Quick Start
Prerequisites
- Go: 1.21 or higher
- Docker: Optional, for containerized deployment
- Git: For cloning the repository
Installation from Source
-
Clone the repository:
git clone https://github.com/perfect-panel/ppanel-server.git cd ppanel-server -
Install dependencies:
go mod download -
Generate code:
chmod +x script/generate.sh ./script/generate.sh -
Build the project:
make linux-amd64 -
Run the server:
./ppanel-server-linux-amd64 run --config etc/ppanel.yaml
🐳 Docker Deployment
-
Build the Docker image:
docker buildx build --platform linux/amd64 -t ppanel-server:latest . -
Run the container:
docker run --rm -p 8080:8080 -v $(pwd)/etc:/app/etc ppanel-server:latest -
Use Docker Compose (create
docker-compose.yml):version: '3.8' services: ppanel-server: image: ppanel-server:latest ports: - "8080:8080" volumes: - ./etc:/app/etc environment: - TZ=Asia/ShanghaiRun:
docker-compose up -d -
Pull from Docker Hub (after CI/CD publishes):
docker pull ppanel/ppanel-server:latest docker run --rm -p 8080:8080 ppanel/ppanel-server:latest
📖 API Documentation
Explore the full API documentation:
The documentation covers all endpoints, request/response formats, and authentication details.
🔗 Related Projects
| Project | Description | Link |
|---|---|---|
| PPanel Web | Frontend for PPanel | GitHub |
| PPanel User Web | User interface for PPanel | Preview |
| PPanel Admin Web | Admin interface for PPanel | Preview |
🌐 Official Website
Visit ppanel.dev for more details.
🏛 Architecture
📁 Directory Structure
.
├── apis/ # API definition files
├── cmd/ # Application entry point
├── doc/ # Documentation
├── etc/ # Configuration files (e.g., ppanel.yaml)
├── generate/ # Code generation tools
├── initialize/ # System initialization
├── internal/ # Internal modules
│ ├── config/ # Configuration parsing
│ ├── handler/ # HTTP handlers
│ ├── middleware/ # HTTP middleware
│ ├── logic/ # Business logic
│ ├── model/ # Data models
│ ├── svc/ # Service layer
│ └── types/ # Type definitions
├── pkg/ # Utility code
├── queue/ # Queue services
├── scheduler/ # Scheduled tasks
├── script/ # Build scripts
├── go.mod # Go module definition
├── Makefile # Build automation
└── Dockerfile # Docker configuration
💻 Development
Format API Files
goctl api format --dir apis/user.api
Add a New API
- Create a new API file in
apis/. - Import it in
apis/ppanel.api. - Regenerate code:
./script/generate.sh
Build for Multiple Platforms
Use the Makefile to build for various platforms (e.g., Linux, Windows, macOS):
make all # Builds linux-amd64, darwin-amd64, windows-amd64
make linux-arm64 # Build for specific platform
Supported platforms include:
- Linux:
386,amd64,arm64,armv5-v7,mips,riscv64,loong64, etc. - Windows:
386,amd64,arm64,armv7 - macOS:
amd64,arm64 - FreeBSD:
amd64,arm64
🤝 Contributing
Contributions are welcome! Please follow the Contribution Guidelines for bug fixes, features, or documentation improvements.
✨ Special Thanks
A huge thank you to the following outstanding open-source projects that have provided invaluable support for this project's development! 🚀
| Project | Description | Project | Description |
|---|---|---|---|
|
Gin |
High-performance Go Web framework |
Gorm |
Powerful Go ORM framework |
![]() Asynq |
Asynchronous task queue for Go |
Go-Swagger |
Comprehensive Go Swagger toolkit |
|
Go-Zero |
Go microservices framework (this project's API generator is built on Go-Zero) |
||
🎉 Salute to Open Source: Thank you to the open-source community for making development simpler and more efficient! Please give these projects a ⭐ to support the open-source movement!
📄 License
This project is licensed under the GPL-3.0 License.

