Source: github.
Go proxy for the Warera API. Forwards tRPC HTTP requests with built-in rate limiting and batch processing.
It is local drop-in replacement for actual warera api server. Setup local proxy and forget about rate-limiting and batching.
Batch size and number of requests per minute are configurable, so if actual warera limits changed, you can just update config.
name: "example"
services:
we_proxy:
container_name: we_proxy
image: poccomaxa/warera-proxy:latest
restart: unless-stopped
environment:
- WARERA_TOKEN=<your-token>
- WARERA_BATCH_SIZE=50
- WARERA_REQUESTS_PER_MINUTE=200
ports:
- 127.0.0.1:<PORT>:8080
Replace <your-token> with your warera API token and <PORT> with your preferred port.
docker build -t poccomaxa/warera-proxy:latest .
docker run -e WARERA_TOKEN=<your-token> -p 127.0.0.1:8080:8080 poccomaxa/warera-proxy:latest
The container exposes port 8080 and includes a health check at /api/health (checks every 30s).
It's recommended to keep internal port 8080 and change only external port. Also it is recommended to bind container only to localhost so only your local scripts can access it.
| Variable | Type | Default | Required | Description |
|---|---|---|---|---|
WARERA_TOKEN | string | - | yes | API authentication token |
WARERA_HOST | string | https://api2.warera.io | no | Upstream API base URL |
WARERA_BATCH_SIZE | int | 50 | no | Max methods per batched request |
WARERA_REQUESTS_PER_MINUTE | float | 200.0 | no | Rate limit for upstream requests |
SERVER_PORT | int | 8080 | no | HTTP server listen port |
LOGGER_DEBUG | bool | false | no | Enable debug logging |
LIFECYCLE_SHUTDOWN_TIMEOUT | duration | 15s | no | Graceful shutdown timeout per service |
GET /trpc/{methods}?input=...&batch=1
POST /trpc/{methods}?batch=1
{methods} - one or more comma-separated tRPC procedure namesinput query parameter - JSON-encoded procedure inputbatch query parameter - set to 1 to enable batch modeGET /trpc/user.getUserLite,user.getUserLite?input={"userId":"..."}&batch=1
{methods} - tRPC procedure namebatch query parameter - set to 1 to enable batch modePOST /trpc/user.getUserLite
Content-Type: application/json
{"userId": "..."}
All responses are Content-Type: application/json. On proxy errors, the response follows the tRPC error format:
{
"error": {
"message": "proxy: <description>",
"code": -1000000000,
"data": {
"code": "PROXY",
"httpStatus": 500,
"path": ""
}
}
}
Can achieve theoretical maximum 166 requests per second.
Warming up http://localhost:8084 ...
Benchmarking http://localhost:8084 for 2m0s with 100 goroutines (get) ...
Completed 20051 requests in 2m0.451s (166 req/s)
=== Benchmark Report ===
Target: http://localhost:8084
Method: get
Duration: 2m0s
Concurrency: 100
Total requests: 20051
--- Latency ---
Min: 55.067345ms
P50: 600.021319ms
P95: 636.919146ms
P99: 829.232335ms
Max: 878.895575ms
Avg: 599.980101ms
--- Status Codes ---
200: 20051
Throughput: 167 req/s
Success rate: 100.0%
Content type
Image
Digest
sha256:f33258c56…
Size
6.9 MB
Last updated
4 months ago
docker pull poccomaxa/warera-proxy