UNPKG

@eooce/xhttp

Version:
117 lines (85 loc) 2.89 kB
# xhttp A serverless VLESS XHTTP proxy server with Nezha monitoring integration. [![npm version](https://badge.fury.io/js/xhttp.svg)](https://badge.fury.io/js/xhttp) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) ## Features - 🚀 **VLESS Protocol**: Modern and efficient proxy protocol - 🔧 **XHTTP Transport**: HTTP-based transport layer - 📊 **Nezha Integration**: Built-in monitoring with Nezha v0/v1 support - ☁️ **Serverless Ready**: Designed for serverless environments - 🔒 **TLS Support**: Automatic TLS for specific ports -**High Performance**: Optimized buffer management and session handling ## Installation ### NPM Package ```bash npm install @eooce/xhttp ``` ### Global Installation ```bash npm install -g @eooce/xhttp ``` ### Direct Usage ```bash npx @eooce/xhttp ``` ## Quick Start ### Basic Usage ```bash # Start with default settings xhttp # Or with Node.js node app.js ``` ### Environment Variables | Variable | Required | Default | Description | |----------|----------|---------|-------------| | `PORT` | No | `3000` | HTTP service port and subscription port | | `UUID` | No | Auto-generated | UUID for VLESS protocol | | `NEZHA_SERVER` | No | - | Nezha panel domain (v1: `nz.aaa.com:8008`, v0: `nz.aaa.com`) | | `NEZHA_PORT` | No | - | Nezha v0 agent port (443,8443,2096,2087,2083,2053 enable TLS) | | `NEZHA_KEY` | No | - | Nezha v1 or v0 secret key | | `DOMAIN` | No | - | Project domain | | `XPATH` | No | Auto-generated | Node path | | `AUTO_ACCESS` | No | `false` | Auto keep-alive (true/false) | | `SUB_PATH` | No | `sub` | Node subscription path | | `NAME` | No | - | Node name | ### Example Configuration ```bash export PORT=8080 export UUID="your-uuid-here" export NEZHA_SERVER="nz.example.com:8008" export NEZHA_KEY="your-nezha-key" export DOMAIN="your-domain.com" export AUTO_ACCESS=true ``` ## API ### HTTP Endpoints - `GET /` - Health check and status - `GET /sub` - Subscription endpoint - `POST /{uuid}` - VLESS proxy data ### Subscription Format ``` http://your-domain:port/sub ``` ## Development ### Prerequisites - Node.js >= 16.0.0 - npm >= 7.0.0 ### Local Development ```bash # Clone repository git clone https://github.com/eooce/serverless-xhttp.git cd serverless-xhttp # Install dependencies npm install # Start development server npm run dev ``` ## License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. ## Contributing Contributions are welcome! Please feel free to submit a Pull Request. ## Support If you encounter any issues, please file an issue on [GitHub](https://github.com/eooce/serverless-xhttp/issues). --- **Note**: This is a serverless VLESS XHTTP proxy server with Nezha monitoring integration. Make sure to configure your environment variables properly for production use.