This commit is contained in:
2026-04-15 15:19:28 +08:00
commit 03229f23d4
159 changed files with 12538 additions and 0 deletions

75
README.md Normal file
View File

@@ -0,0 +1,75 @@
# DPS Manager Server
This directory contains the current C++17 service implementation. The legacy Java project is kept only as a behavior reference under `旧的java项目/`.
## Build targets
The server now uses one codebase with the same runtime behavior on:
- Windows: `MSVC + xmake`
- Linux: `gcc/clang + xmake`
`mingw` is no longer the primary target for this service.
## Dependencies
Xmake resolves these shared dependencies for both platforms:
- `openssl3`
- `zlib`
- `mariadb-connector-c`
Platform system links:
- Windows: `ws2_32`
- Linux: `pthread`
## Database TLS
- `database.ssl_mode=disable`: disable TLS for local Windows testing
- `database.ssl_mode=preferred`: allow TLS without strict certificate validation
- `database.ssl_mode=required`: require TLS but skip certificate validation
- `database.ssl_mode=verify_ca`: require TLS and verify the server certificate chain
- `database.ssl_mode=verify_identity`: same strict verification path as `verify_ca` in the current Connector/C integration
- `database.ssl_ca`: optional CA certificate file path for strict verification modes
- `database.plugin_dir`: optional MariaDB auth plugin directory override; Windows builds also copy connector plugins to `mariadb-plugin` beside the executable
## Build
### Windows local testing
```powershell
xmake f -p windows -a x64 -m debug
xmake
Copy-Item config/server.windows.conf config/server.conf
```
### Linux deployment build
```bash
xmake f -p linux -a x86_64 -m release
xmake
cp config/server.conf.example config/server.conf
```
## Run
Windows:
```powershell
./build/windows/x64/debug/dps_manager_server.exe --config config/server.conf
```
Linux:
```bash
./build/linux/x86_64/release/dps_manager_server --config config/server.conf
```
## Notes
- Password hashing, JWT signing, RSA operations, and gzip payload generation all use the same OpenSSL/zlib-based implementation on Windows and Linux.
- The server fails fast on startup if the database connection cannot be established.
- Windows local testing can set `database.ssl_mode=disable` when the remote database presents a certificate chain that Windows does not trust yet.
- Proxy headers are ignored by default; enable `server.trust_proxy=true` only when the service runs behind a trusted reverse proxy.
- `config/server.conf.example` is the Linux-oriented template, and `config/server.windows.conf` is the Windows local test template.