diff --git a/README.md b/README.md new file mode 100644 index 0000000..8d5a754 --- /dev/null +++ b/README.md @@ -0,0 +1,193 @@ +# PPanel Server + +
+ +[![License](https://img.shields.io/github/license/perfect-panel/ppanel-server)](LICENSE) +![Go Version](https://img.shields.io/badge/Go-1.21%2B-blue) +[![Docker](https://img.shields.io/badge/Docker-Available-blue)](Dockerfile) +[![CI/CD](https://img.shields.io/github/actions/workflow/status/perfect-panel/ppanel-server/build-and-release.yml)](.github/workflows/build-and-release.yml) + +**PPanel is a pure, professional, and perfect open-source proxy panel tool, designed for learning and practical use.** + +[English](README.md) | [中文](README_zh.md) | [Report Bug](https://github.com/perfect-panel/ppanel-server/issues/new) | [Request Feature](https://github.com/perfect-panel/ppanel-server/issues/new) + +
+ +## 📋 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. + +## 🚀 Quick Start + +### Prerequisites + +- **Go**: 1.21 or higher +- **Docker**: Optional, for containerized deployment +- **Git**: For cloning the repository + +### Installation from Source + +1. **Clone the repository**: + ```bash + git clone https://github.com/perfect-panel/ppanel-server.git + cd ppanel-server + ``` + +2. **Install dependencies**: + ```bash + go mod download + ``` + +3. **Generate code**: + ```bash + chmod +x script/generate.sh + ./script/generate.sh + ``` + +4. **Build the project**: + ```bash + make linux-amd64 + ``` + +5. **Run the server**: + ```bash + ./ppanel-server-linux-amd64 run --config etc/ppanel.yaml + ``` + +### 🐳 Docker Deployment + +1. **Build the Docker image**: + ```bash + docker buildx build --platform linux/amd64 -t ppanel-server:latest . + ``` + +2. **Run the container**: + ```bash + docker run --rm -p 8080:8080 -v $(pwd)/etc:/app/etc ppanel-server:latest + ``` + +3. **Use Docker Compose** (create `docker-compose.yml`): + ```yaml + version: '3.8' + services: + ppanel-server: + image: ppanel-server:latest + ports: + - "8080:8080" + volumes: + - ./etc:/app/etc + environment: + - TZ=Asia/Shanghai + ``` + Run: + ```bash + docker-compose up -d + ``` + +4. **Pull from Docker Hub** (after CI/CD publishes): + ```bash + docker pull yourusername/ppanel-server:latest + docker run --rm -p 8080:8080 yourusername/ppanel-server:latest + ``` + +## 📖 API Documentation + +Explore the full API documentation: + +- **Swagger**: [https://ppanel.dev/swagger/ppanel](https://ppanel.dev/swagger/ppanel) + +The documentation covers all endpoints, request/response formats, and authentication details. + +## 🔗 Related Projects + +| Project | Description | Link | +|------------------|----------------------------|-------------------------------------------------------| +| PPanel Web | Frontend for PPanel | [GitHub](https://github.com/perfect-panel/ppanel-web) | +| PPanel User Web | User interface for PPanel | [Preview](https://user.ppanel.dev) | +| PPanel Admin Web | Admin interface for PPanel | [Preview](https://admin.ppanel.dev) | + +## 🌐 Official Website + +Visit [ppanel.dev](https://ppanel.dev/) for more details. + +## 📁 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 +```bash +goctl api format --dir apis/user.api +``` + +### Add a New API + +1. Create a new API file in `apis/`. +2. Import it in `apis/ppanel.api`. +3. Regenerate code: + ```bash + ./script/generate.sh + ``` + +### Build for Multiple Platforms + +Use the `Makefile` to build for various platforms (e.g., Linux, Windows, macOS): + +```bash +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](CONTRIBUTING.md) for bug fixes, features, or +documentation improvements. + +## 📄 License + +This project is licensed under the [GPL-3.0 License](LICENSE). \ No newline at end of file diff --git a/readme.md b/readme.md deleted file mode 100644 index 9f77473..0000000 --- a/readme.md +++ /dev/null @@ -1,165 +0,0 @@ -# PPanel Server - -
- -[![License](https://img.shields.io/github/license/perfect-panel/ppanel-server)](LICENSE) -![Go Version](https://img.shields.io/badge/Go-1.16%2B-blue) -[![Docker](https://img.shields.io/badge/Docker-Available-blue)](Dockerfile) - -**PPanel is a pure, professional, and perfect open-source proxy panel tool, designed to be your ideal choice for -learning and practical use.** - -[English](README.md) | [中文](readme_zh.md) | [Report Bug](https://github.com/perfect-panel/server/issues/new) | [Request Feature](https://github.com/perfect-panel/server/issues/new) - -
- -## 📋 Overview - -PPanel Server is the backend component of the PPanel project, providing robust APIs and core functionality for the -PPanel system. It's built with Go and designed with performance, security, and scalability in mind. - -### Key Features - -- **Multi-Protocol Support**: Manages various encryption protocols including Shadowsocks, V2Ray, Trojan, and more -- **Privacy Protection**: No user logs are collected, ensuring user privacy and security -- **Minimalist Design**: Easy-to-use product while maintaining the integrity of business logic -- **User System**: Complete user management with authentication and authorization -- **Subscription Management**: Handle user subscriptions and service provisions -- **Payment Integration**: Multiple payment gateway support -- **Order Management**: Process and track user orders -- **Ticket System**: Customer support and issue tracking -- **Node Management**: Server node monitoring and control -- **API Framework**: Comprehensive API interfaces for frontend applications - -## 🚀 Quick Start - -### Prerequisites - -- Go 1.16+ -- Docker (optional, for containerized deployment) - -### Running from Source Code - -1. Clone the repository - -```bash -git clone https://github.com/perfect-panel/server.git -cd ppanel-server -``` - -2. Install dependencies - -```bash -go mod download -``` - -3. Generate code - -```bash -chmod +x script/generate.sh -./script/generate.sh -``` - -4. Build the project - -```bash -go build -o ppanel ppanel.go -``` - -5. Start the server - -```bash -./ppanel run --config etc/ppanel.yaml -``` - -### 🐳 Docker Deployment - -1. Build Docker image - -```bash -docker build -t ppanel-server . -``` - -2. Run container - -```bash -docker run -p 8080:8080 -v $(pwd)/etc/ppanel.yaml:/app/etc/ppanel.yaml ppanel-server -``` - -Or use Docker Compose: - -```bash -docker-compose up -d -``` - -## 📖 API Documentation - -PPanel provides comprehensive API documentation available online: - -- **Official Swagger Documentation**: [https://ppanel.dev/swagger/ppanel](https://ppanel.dev/swagger/ppanel) - -The documentation includes all available API endpoints, request/response formats, and authentication requirements. - -## 🔗 Related Projects - -| Project | Description | Link | -|------------------|----------------------------------|-------------------------------------------------------| -| PPanel Web | Frontend applications for PPanel | [GitHub](https://github.com/perfect-panel/ppanel-web) | -| PPanel User Web | User interface for PPanel | [Preview](https://user.ppanel.dev) | -| PPanel Admin Web | Admin interface for PPanel | [Preview](https://admin.ppanel.dev) | - -## 🌐 Official Website - -For more information, visit our official website: [ppanel.dev](https://ppanel.dev/) - -## 📁 Directory Structure - -``` -. -├── etc # Configuration files directory -├── cmd # Application entry point -├── queue # Queue consumption service -├── generate # Code generation tools -├── initialize # System initialization configuration -├── go.mod # Go module definition -├── internal # Internal modules -│ ├── config # Configuration file parsing -│ ├── handler # HTTP interface handling -│ ├── middleware # HTTP middleware -│ ├── logic # Business logic processing -│ ├── svc # Service layer encapsulation -│ ├── types # Type definitions -│ └── model # Data models -├── scheduler # Scheduled tasks -├── pkg # Common utility code -├── apis # API definition files -├── script # Build scripts -└── doc # Documentation -``` - -## 💻 Development - -### Format API File - -```bash -goctl api format --dir api/user.api -``` - -### Adding New API - -1. Create a new API definition file in the `apis` directory -2. Import the new API definition in the `ppanel.api` file -3. Run the generation script to regenerate the code - -```bash -./script/generate.sh -``` - -## 🤝 Contributing - -We welcome all forms of contribution, whether it's feature development, bug fixes, or documentation improvements. Please -check the [Contribution Guidelines](CONTRIBUTING.md) for more details. - -## 📄 License - -This project is licensed under the [GPL-3.0 License](LICENSE). \ No newline at end of file diff --git a/readme_zh.md b/readme_zh.md index 0087488..b747518 100644 --- a/readme_zh.md +++ b/readme_zh.md @@ -3,160 +3,189 @@
[![License](https://img.shields.io/github/license/perfect-panel/ppanel-server)](LICENSE) -![Go Version](https://img.shields.io/badge/Go-1.16%2B-blue) +![Go Version](https://img.shields.io/badge/Go-1.21%2B-blue) [![Docker](https://img.shields.io/badge/Docker-Available-blue)](Dockerfile) +[![CI/CD](https://img.shields.io/github/actions/workflow/status/perfect-panel/ppanel-server/build-and-release.yml)](.github/workflows/build-and-release.yml) **PPanel 是一个纯净、专业、完美的开源代理面板工具,旨在成为您学习和实际使用的理想选择。** -[English](README.md) | [中文](readme_zh.md) | [报告问题](https://github.com/perfect-panel/server/issues/new) | [功能请求](https://github.com/perfect-panel/server/issues/new) +[English](README.md) | [中文](readme_zh.md) | [报告问题](https://github.com/perfect-panel/ppanel-server/issues/new) | [功能请求](https://github.com/perfect-panel/ppanel-server/issues/new)
## 📋 概述 -PPanel 服务端是 PPanel 项目的后端组件,为 PPanel 系统提供强大的 API 和核心功能。它使用 Go 语言构建,注重性能、安全性和可扩展性。 +PPanel 服务端是 PPanel 项目的后端组件,为代理服务提供强大的 API 和核心功能。它基于 Go 语言开发,注重性能、安全性和可扩展性。 ### 核心特性 -- **多协议支持**:管理各种加密协议,包括 Shadowsocks、V2Ray、Trojan 等 -- **隐私保护**:不收集用户日志,确保用户隐私和安全 -- **极简设计**:易于使用的产品,同时保持业务逻辑的完整性 -- **用户系统**:完整的用户管理,包含认证和授权 -- **订阅管理**:处理用户订阅和服务提供 -- **支付集成**:支持多种支付网关 -- **订单管理**:处理和跟踪用户订单 -- **工单系统**:客户支持和问题跟踪 -- **节点管理**:服务器节点监控和控制 -- **API 框架**:为前端应用提供全面的 API 接口 +- **多协议支持**:支持 Shadowsocks、V2Ray、Trojan 等多种加密协议。 +- **隐私保护**:不收集用户日志,确保隐私和安全。 +- **极简设计**:简单易用,保留完整的业务逻辑。 +- **用户管理**:完善的认证和授权系统。 +- **订阅管理**:处理用户订阅和服务开通。 +- **支付集成**:支持多种支付网关。 +- **订单管理**:跟踪和处理用户订单。 +- **工单系统**:内置客户支持和问题跟踪。 +- **节点管理**:监控和控制服务器节点。 +- **API 框架**:提供全面的 RESTful API,供前端集成。 ## 🚀 快速开始 ### 前提条件 -- Go 1.16+ -- Docker(可选,用于容器化部署) +- **Go**:1.21 或更高版本 +- **Docker**:可选,用于容器化部署 +- **Git**:用于克隆仓库 ### 通过源代码运行 -1. 克隆仓库 +1. **克隆仓库**: + ```bash + git clone https://github.com/perfect-panel/ppanel-server.git + cd ppanel-server + ``` -```bash -git clone https://github.com/perfect-panel/server.git -cd ppanel-server -``` +2. **安装依赖**: + ```bash + go mod download + ``` -2. 安装依赖 +3. **生成代码**: + ```bash + chmod +x script/generate.sh + ./script/generate.sh + ``` -```bash -go mod download -``` +4. **构建项目**: + ```bash + make linux-amd64 + ``` -3. 生成代码 - -```bash -chmod +x script/generate.sh -./script/generate.sh -``` - -4. 构建项目 - -```bash -go build -o ppanel ppanel.go -``` - -5. 启动服务器 - -```bash -./ppanel run --config etc/ppanel.yaml -``` +5. **启动服务器**: + ```bash + ./ppanel-server-linux-amd64 run --config etc/ppanel.yaml + ``` ### 🐳 Docker 部署 -1. 构建 Docker 镜像 +1. **构建 Docker 镜像**: + ```bash + docker buildx build --platform linux/amd64 -t ppanel-server:latest . + ``` -```bash -docker build -t ppanel-server . -``` +2. **运行容器**: + ```bash + docker run --rm -p 8080:8080 -v $(pwd)/etc:/app/etc ppanel-server:latest + ``` -2. 运行容器 +3. **使用 Docker Compose**(创建 `docker-compose.yml`): + ```yaml + version: '3.8' + services: + ppanel-server: + image: ppanel-server:latest + ports: + - "8080:8080" + volumes: + - ./etc:/app/etc + environment: + - TZ=Asia/Shanghai + ``` + 运行: + ```bash + docker-compose up -d + ``` -```bash -docker run -p 8080:8080 -v $(pwd)/etc/ppanel.yaml:/app/etc/ppanel.yaml ppanel-server -``` - -或使用 Docker Compose: - -```bash -docker-compose up -d -``` +4. **从 Docker Hub 拉取**(CI/CD 发布后): + ```bash + docker pull yourusername/ppanel-server:latest + docker run --rm -p 8080:8080 yourusername/ppanel-server:latest + ``` ## 📖 API 文档 -PPanel 提供了全面的在线 API 文档: +查看完整的 API 文档: -- **官方 Swagger 文档**:[https://ppanel.dev/zh-CN/swagger/ppanel](https://ppanel.dev/zh-CN/swagger/ppanel) +- **Swagger 文档**:[https://ppanel.dev/zh-CN/swagger/ppanel](https://ppanel.dev/zh-CN/swagger/ppanel) -该文档包含所有可用的 API 端点、请求/响应格式以及认证需求。 +文档涵盖所有 API 端点、请求/响应格式及认证要求。 ## 🔗 相关项目 -| 项目 | 描述 | 链接 | -|------------------|---------------|-------------------------------------------------------| -| PPanel Web | PPanel 的前端应用 | [GitHub](https://github.com/perfect-panel/ppanel-web) | -| PPanel User Web | PPanel 的用户界面 | [预览](https://user.ppanel.dev) | -| PPanel Admin Web | PPanel 的管理员界面 | [预览](https://admin.ppanel.dev) | +| 项目 | 描述 | 链接 | +|------------------|--------------|-------------------------------------------------------| +| PPanel Web | PPanel 前端应用 | [GitHub](https://github.com/perfect-panel/ppanel-web) | +| PPanel User Web | PPanel 用户界面 | [预览](https://user.ppanel.dev) | +| PPanel Admin Web | PPanel 管理员界面 | [预览](https://admin.ppanel.dev) | ## 🌐 官方网站 -访问我们的官方网站获取更多信息:[ppanel.dev](https://ppanel.dev/) +访问 [ppanel.dev](https://ppanel.dev/) 获取更多信息。 ## 📁 目录结构 ``` . -├── etc # 配置文件目录 -├── cmd # 应用入口 -├── queue # 队列消费服务 -├── generate # 代码生成工具 -├── initialize # 系统初始化配置 +├── apis/ # API 定义文件 +├── cmd/ # 应用程序入口 +├── doc/ # 文档 +├── etc/ # 配置文件(如 ppanel.yaml) +├── generate/ # 代码生成工具 +├── initialize/ # 系统初始化 +├── internal/ # 内部模块 +│ ├── config/ # 配置文件解析 +│ ├── handler/ # HTTP 处理程序 +│ ├── middleware/ # HTTP 中间件 +│ ├── logic/ # 业务逻辑 +│ ├── model/ # 数据模型 +│ ├── svc/ # 服务层 +│ └── types/ # 类型定义 +├── pkg/ # 公共工具代码 +├── queue/ # 队列服务 +├── scheduler/ # 定时任务 +├── script/ # 构建脚本 ├── go.mod # Go 模块定义 -├── internal # 内部模块 -│ ├── config # 配置文件解析 -│ ├── handler # HTTP 接口处理 -│ ├── middleware # HTTP 中间件 -│ ├── logic # 业务逻辑处理 -│ ├── svc # 服务层封装 -│ ├── types # 类型定义 -│ └── model # 数据模型 -├── scheduler # 计划任务 -├── pkg # 公共工具代码 -├── apis # API 定义文件 -├── script # 构建脚本 -└── doc # 文档 +├── Makefile # 构建自动化 +└── Dockerfile # Docker 配置 ``` ## 💻 开发 ### 格式化 API 文件 - ```bash -goctl api format --dir api/user.api +goctl api format --dir apis/user.api ``` ### 添加新 API -1. 在 `apis` 目录下创建新的 API 定义文件 -2. 在 `ppanel.api` 文件中导入新的 API 定义 -3. 运行生成脚本重新生成代码 +1. 在 `apis/` 目录创建新的 API 文件。 +2. 在 `apis/ppanel.api` 中导入新 API。 +3. 重新生成代码: + ```bash + ./script/generate.sh + ``` + +### 多平台构建 + +使用 `Makefile` 构建多种平台(如 Linux、Windows、macOS): ```bash -./script/generate.sh +make all # 构建 linux-amd64、darwin-amd64、windows-amd64 +make linux-arm64 # 构建特定平台 ``` +支持的平台包括: + +- Linux:`386`、`amd64`、`arm64`、`armv5-v7`、`mips`、`riscv64`、`loong64` 等 +- Windows:`386`、`amd64`、`arm64`、`armv7` +- macOS:`amd64`、`arm64` +- FreeBSD:`amd64`、`arm64` + ## 🤝 贡献 -我们欢迎各种形式的贡献,无论是功能开发、错误修复还是文档改进。请查看[贡献指南](CONTRIBUTING_ZH.md)了解更多详情。 +欢迎各种贡献,包括功能开发、错误修复和文档改进。请查看[贡献指南](CONTRIBUTING_ZH.md)了解详情。 ## 📄 许可证 -本项目采用 [GPL-3.0 许可证](LICENSE) 授权。 +本项目采用 [GPL-3.0 许可证](LICENSE) 授权。 \ No newline at end of file