mirror of
https://github.com/0x1d/rcond.git
synced 2025-12-16 10:54:29 +01:00
69 lines
1.5 KiB
Markdown
69 lines
1.5 KiB
Markdown
# rcond
|
|
|
|
A simple daemon to manage network connections through NetworkManager's D-Bus interface.
|
|
|
|
It provides a REST API to:
|
|
- Create and activate WiFi connections
|
|
- Deactivate WiFi connections
|
|
- Remove stored connection profiles
|
|
|
|
The daemon is designed to run on Linux systems with NetworkManager.
|
|
|
|
## Build and Run
|
|
|
|
```bash
|
|
make build
|
|
make run
|
|
```
|
|
|
|
## API
|
|
|
|
The full API specification can be found in [api/rcond.yaml](api/rcond.yaml).
|
|
|
|
### Endpoints
|
|
|
|
| Method | Path | Description |
|
|
|--------|------|-------------|
|
|
| GET | `/health` | Health check endpoint that returns status |
|
|
| POST | `/network/up` | Create and activate a WiFi access point |
|
|
| POST | `/network/down` | Deactivate a WiFi interface |
|
|
| POST | `/network/remove` | Remove the stored connection profile |
|
|
|
|
### Response Codes
|
|
|
|
- 200: Success
|
|
- 400: Bad request (invalid JSON payload)
|
|
- 405: Method not allowed
|
|
- 500: Internal server error
|
|
|
|
### Request/Response Format
|
|
All endpoints use JSON for request and response payloads.
|
|
|
|
### 1) Bring a network up
|
|
|
|
```bash
|
|
curl -v -X POST http://localhost:8080/network/up \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"interface": "wlan0",
|
|
"ssid": "MyNetworkSSID",
|
|
"password": "SuperSecretPassword"
|
|
}'
|
|
```
|
|
|
|
### 2) Bring a network down
|
|
|
|
```bash
|
|
curl -v -X POST http://localhost:8080/network/down \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"interface": "wlan0"
|
|
}'
|
|
```
|
|
|
|
### 3) Remove the stored connection
|
|
|
|
```bash
|
|
curl -v -X POST http://localhost:8080/network/remove
|
|
```
|