refactor: reorganize project into src layout and update API documentation

Update project structure to use a src/ directory layout and
improve documentation across multiple files.

- Update README.md build command to use ./src
- Add directory structure documentation
- Update status endpoint to include DB health status
- Add pagination support (limit/offset) to whitelist list endpoints
- Document new query parameters with examples
- Update deployment guide to mark API token as required
- Add testing instructions
- Clarify audit log rotation in design documentation
This commit is contained in:
db123-test
2026-05-05 11:51:45 +03:30
parent 33b0e4e30e
commit 8d25bda386
6 changed files with 143 additions and 14 deletions

View File

@@ -35,6 +35,13 @@ List all currently active temporary whitelisted IPs.
**Authorization:** Bearer `{API_TOKEN}`
**Query parameters:**
| Parameter | Type | Required | Default | Description |
|-----------|--------|----------|---------|---------------------------------------------------------------------|
| `limit` | int | No | 200 | Number of entries to return (max 1000) |
| `offset` | int | No | 0 | Number of entries to skip |
**Response body:**
```json
@@ -47,6 +54,13 @@ List all currently active temporary whitelisted IPs.
]
```
**Example:**
```bash
curl -X GET "http://127.0.0.1:8080/api/whitelist/temp/list?limit=50&offset=0" \
-H "Authorization: Bearer CHANGE_ME"
```
### DELETE /api/whitelist/temp/{ip}
Remove a temporary whitelisted IP.
@@ -86,6 +100,13 @@ List all currently active permanent whitelisted IPs.
**Authorization:** Bearer `{API_TOKEN}`
**Query parameters:**
| Parameter | Type | Required | Default | Description |
|-----------|--------|----------|---------|---------------------------------------------------------------------|
| `limit` | int | No | 200 | Number of entries to return (max 1000) |
| `offset` | int | No | 0 | Number of entries to skip |
**Response body:**
```json
@@ -96,6 +117,13 @@ List all currently active permanent whitelisted IPs.
]
```
**Example:**
```bash
curl -X GET "http://127.0.0.1:8080/api/whitelist/perm/list?limit=50&offset=0" \
-H "Authorization: Bearer CHANGE_ME"
```
### DELETE /api/whitelist/perm/{entry}
Remove a permanent whitelisted IP or CIDR range.
@@ -149,9 +177,19 @@ The NGINX auth_request endpoint. Do NOT call this directly.
### GET /status
Health check.
Health check with DB status.
**Response:** 200 `ok`
**Response:** 200 `application/json`
```json
{
"status": "ok",
"uptime": "1h30m0s",
"perm_whitelist_count": 15,
"temp_whitelist_count": 3,
"db_ok": true
}
```
## Security notes