Specify Dockerfile in waylume-server build configuration
This commit is contained in:
29
README.md
29
README.md
@@ -32,10 +32,10 @@ Client applications communicate through Supabase to discover available Waylume s
|
||||
|
||||
### API Endpoints
|
||||
- `POST /api/peers` - Create new VPN peer with generated keys and configuration
|
||||
- `DELETE /api/peers/{publicKey}` - Remove VPN peer
|
||||
- `PUT /api/peers/{publicKey}/speed-limit` - Set bandwidth limits for peer
|
||||
- `PUT /api/peers/{publicKey}/data-cap` - Set data usage limits for peer
|
||||
- `GET /api/peers/{publicKey}/config` - Retrieve peer configuration (not implemented)
|
||||
- `POST /api/peers/delete` - Remove VPN peer (publicKey in request body)
|
||||
- `POST /api/peers/speed-limit` - Set bandwidth limits for peer (publicKey + speedKbps in request body)
|
||||
- `POST /api/peers/data-cap` - Set data usage limits for peer (publicKey + dataCapMB in request body)
|
||||
- `POST /api/peers/config` - Retrieve peer configuration (publicKey in request body, not implemented)
|
||||
|
||||
### Security Features
|
||||
- Peer isolation using iptables rules (prevents peer-to-peer communication)
|
||||
@@ -119,23 +119,32 @@ Response:
|
||||
}
|
||||
```
|
||||
|
||||
### Delete a peer
|
||||
```bash
|
||||
curl -X POST http://localhost:3000/api/peers/delete \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"publicKey": "PEER_PUBLIC_KEY_HERE"}'
|
||||
```
|
||||
|
||||
### Set speed limit for peer
|
||||
```bash
|
||||
curl -X PUT http://localhost:3000/api/peers/{publicKey}/speed-limit \
|
||||
curl -X POST http://localhost:3000/api/peers/speed-limit \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"speedKbps": 1000}'
|
||||
-d '{"publicKey": "PEER_PUBLIC_KEY_HERE", "speedKbps": 1000}'
|
||||
```
|
||||
|
||||
### Set data cap for peer
|
||||
```bash
|
||||
curl -X PUT http://localhost:3000/api/peers/{publicKey}/data-cap \
|
||||
curl -X POST http://localhost:3000/api/peers/data-cap \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"dataCapMB": 1024}'
|
||||
-d '{"publicKey": "PEER_PUBLIC_KEY_HERE", "dataCapMB": 1024}'
|
||||
```
|
||||
|
||||
### Delete a peer
|
||||
### Get peer config
|
||||
```bash
|
||||
curl -X DELETE http://localhost:3000/api/peers/{publicKey}
|
||||
curl -X POST http://localhost:3000/api/peers/config \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"publicKey": "PEER_PUBLIC_KEY_HERE"}'
|
||||
```
|
||||
|
||||
## Network Architecture
|
||||
|
||||
@@ -9,10 +9,10 @@ class PeerRoutes {
|
||||
final router = Router();
|
||||
|
||||
router.post('/peers', _createPeer);
|
||||
router.delete('/peers/<publicKey>', _deletePeer);
|
||||
router.get('/peers/<publicKey>/config', _getPeerConfig);
|
||||
router.put('/peers/<publicKey>/speed-limit', _setSpeedLimit);
|
||||
router.put('/peers/<publicKey>/data-cap', _setDataCap);
|
||||
router.post('/peers/delete', _deletePeer);
|
||||
router.post('/peers/config', _getPeerConfig);
|
||||
router.post('/peers/speed-limit', _setSpeedLimit);
|
||||
router.post('/peers/data-cap', _setDataCap);
|
||||
|
||||
return router;
|
||||
}
|
||||
@@ -42,9 +42,21 @@ class PeerRoutes {
|
||||
}
|
||||
|
||||
Future<Response> _deletePeer(Request request) async {
|
||||
final publicKey = request.params['publicKey']!;
|
||||
|
||||
try {
|
||||
final body = await request.readAsString();
|
||||
final data = jsonDecode(body) as Map<String, dynamic>;
|
||||
final publicKey = data['publicKey'] as String?;
|
||||
|
||||
if (publicKey == null) {
|
||||
return Response.badRequest(
|
||||
body: jsonEncode({
|
||||
'success': false,
|
||||
'error': 'publicKey parameter is required',
|
||||
}),
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
);
|
||||
}
|
||||
|
||||
final success = await deletePeer(publicKey);
|
||||
|
||||
return Response.ok(
|
||||
@@ -66,9 +78,21 @@ class PeerRoutes {
|
||||
}
|
||||
|
||||
Future<Response> _getPeerConfig(Request request) async {
|
||||
final publicKey = request.params['publicKey']!;
|
||||
|
||||
try {
|
||||
final body = await request.readAsString();
|
||||
final data = jsonDecode(body) as Map<String, dynamic>;
|
||||
final publicKey = data['publicKey'] as String?;
|
||||
|
||||
if (publicKey == null) {
|
||||
return Response.badRequest(
|
||||
body: jsonEncode({
|
||||
'success': false,
|
||||
'error': 'publicKey parameter is required',
|
||||
}),
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
);
|
||||
}
|
||||
|
||||
return Response.notFound(
|
||||
jsonEncode({
|
||||
'success': false,
|
||||
@@ -88,13 +112,22 @@ class PeerRoutes {
|
||||
}
|
||||
|
||||
Future<Response> _setSpeedLimit(Request request) async {
|
||||
final publicKey = request.params['publicKey']!;
|
||||
|
||||
try {
|
||||
final body = await request.readAsString();
|
||||
final data = jsonDecode(body) as Map<String, dynamic>;
|
||||
final publicKey = data['publicKey'] as String?;
|
||||
final speedKbps = data['speedKbps'] as int?;
|
||||
|
||||
if (publicKey == null) {
|
||||
return Response.badRequest(
|
||||
body: jsonEncode({
|
||||
'success': false,
|
||||
'error': 'publicKey parameter is required',
|
||||
}),
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
);
|
||||
}
|
||||
|
||||
if (speedKbps == null) {
|
||||
return Response.badRequest(
|
||||
body: jsonEncode({
|
||||
@@ -126,13 +159,22 @@ class PeerRoutes {
|
||||
}
|
||||
|
||||
Future<Response> _setDataCap(Request request) async {
|
||||
final publicKey = request.params['publicKey']!;
|
||||
|
||||
try {
|
||||
final body = await request.readAsString();
|
||||
final data = jsonDecode(body) as Map<String, dynamic>;
|
||||
final publicKey = data['publicKey'] as String?;
|
||||
final dataCapMB = data['dataCapMB'] as int?;
|
||||
|
||||
if (publicKey == null) {
|
||||
return Response.badRequest(
|
||||
body: jsonEncode({
|
||||
'success': false,
|
||||
'error': 'publicKey parameter is required',
|
||||
}),
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
);
|
||||
}
|
||||
|
||||
if (dataCapMB == null) {
|
||||
return Response.badRequest(
|
||||
body: jsonEncode({
|
||||
|
||||
Reference in New Issue
Block a user