feat(app): add WGRplane web UI and backend features
- Add Vue 3 frontend with glassmorphism design (Tailwind CSS) - Add Go backend handlers: auth, webhooks, stats, scheduler, validation - Add i18n support (EN, ID, ZH) - Add Swagger docs and API handlers - Add nftables integration and plugins support - Remove deprecated go.mod (migrated to wgrplane)
This commit is contained in:
+1244
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,777 @@
|
||||
basePath: /
|
||||
definitions:
|
||||
main.Peer:
|
||||
properties:
|
||||
allowAccess:
|
||||
items:
|
||||
type: integer
|
||||
type: array
|
||||
allowInternet:
|
||||
type: boolean
|
||||
createdAt:
|
||||
type: string
|
||||
currentDataUsageBytes:
|
||||
description: CurrentDataUsageBytes tracks the amount of data used by this
|
||||
peer (in bytes)
|
||||
format: int64
|
||||
type: integer
|
||||
dataLimitGB:
|
||||
description: DataLimitGB defines the monthly data limit per peer (in GB).
|
||||
0 means unlimited.
|
||||
format: int64
|
||||
type: integer
|
||||
enabled:
|
||||
description: Enabled indicates whether the peer is active. Auto-restrict disables
|
||||
the peer if over the limit.
|
||||
type: boolean
|
||||
expiresAt:
|
||||
description: ExpiresAt defines when this peer should be considered expired
|
||||
and eligible for auto-deletion
|
||||
type: string
|
||||
id:
|
||||
type: integer
|
||||
ip:
|
||||
type: string
|
||||
publicKey:
|
||||
type: string
|
||||
serverID:
|
||||
type: integer
|
||||
updatedAt:
|
||||
type: string
|
||||
type: object
|
||||
main.SMTPSettings:
|
||||
properties:
|
||||
enabled:
|
||||
type: boolean
|
||||
fromEmail:
|
||||
type: string
|
||||
fromName:
|
||||
type: string
|
||||
id:
|
||||
type: integer
|
||||
password:
|
||||
type: string
|
||||
port:
|
||||
type: integer
|
||||
server:
|
||||
type: string
|
||||
useAuth:
|
||||
type: boolean
|
||||
useTLS:
|
||||
type: boolean
|
||||
username:
|
||||
type: string
|
||||
type: object
|
||||
main.Server:
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
endpoint:
|
||||
type: string
|
||||
id:
|
||||
type: integer
|
||||
mode:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
peers:
|
||||
items:
|
||||
$ref: '#/definitions/main.Peer'
|
||||
type: array
|
||||
publicKey:
|
||||
type: string
|
||||
updatedAt:
|
||||
type: string
|
||||
webhooks:
|
||||
items:
|
||||
$ref: '#/definitions/main.Webhook'
|
||||
type: array
|
||||
type: object
|
||||
main.Webhook:
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
customBody:
|
||||
type: string
|
||||
customHeaders:
|
||||
items:
|
||||
type: integer
|
||||
type: array
|
||||
defaultPayload:
|
||||
type: string
|
||||
id:
|
||||
type: integer
|
||||
isEnabled:
|
||||
type: boolean
|
||||
isGlobal:
|
||||
type: boolean
|
||||
name:
|
||||
type: string
|
||||
serverID:
|
||||
type: integer
|
||||
subscribedActions:
|
||||
items:
|
||||
type: integer
|
||||
type: array
|
||||
template:
|
||||
type: string
|
||||
updatedAt:
|
||||
type: string
|
||||
url:
|
||||
type: string
|
||||
verifySSL:
|
||||
type: boolean
|
||||
type: object
|
||||
host: localhost:10087
|
||||
info:
|
||||
contact:
|
||||
name: API Support
|
||||
description: WireGuard Control Plane with Dynamic Policy Firewall. REST API for
|
||||
managing WireGuard servers, peers, webhooks, SMTP settings, and real-time stats.
|
||||
title: WGRplane API
|
||||
version: "1.0"
|
||||
paths:
|
||||
/api/peers/{id}:
|
||||
delete:
|
||||
description: Deletes a peer, cleans up nftables rules, and triggers webhooks.
|
||||
parameters:
|
||||
- description: Peer ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"204":
|
||||
description: No content
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: Delete a peer
|
||||
tags:
|
||||
- peers
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Updates a peer and computes diffs to apply incremental nftables
|
||||
changes.
|
||||
parameters:
|
||||
- description: Peer ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
- description: Updated peer fields
|
||||
in: body
|
||||
name: peer
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/main.Peer'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/main.Peer'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: Update a peer
|
||||
tags:
|
||||
- peers
|
||||
/api/peers/{id}/config:
|
||||
get:
|
||||
description: Downloads the WireGuard .conf file for a specific peer.
|
||||
parameters:
|
||||
- description: Peer ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- text/plain
|
||||
responses:
|
||||
"200":
|
||||
description: WireGuard configuration file
|
||||
schema:
|
||||
type: string
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: Get peer config
|
||||
tags:
|
||||
- peers
|
||||
/api/peers/{id}/qrcode:
|
||||
get:
|
||||
description: Returns a QR code PNG image of the peer config for mobile import.
|
||||
parameters:
|
||||
- description: Peer ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- image/png
|
||||
responses:
|
||||
"200":
|
||||
description: QR code PNG image
|
||||
schema:
|
||||
type: file
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: Get peer QR code
|
||||
tags:
|
||||
- peers
|
||||
/api/servers:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Returns a list of all registered WireGuard servers.
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/main.Server'
|
||||
type: array
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: List all servers
|
||||
tags:
|
||||
- servers
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Creates a new WireGuard server with the provided configuration.
|
||||
parameters:
|
||||
- description: Server configuration
|
||||
in: body
|
||||
name: server
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/main.Server'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: Created
|
||||
schema:
|
||||
$ref: '#/definitions/main.Server'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: Create a server
|
||||
tags:
|
||||
- servers
|
||||
/api/servers/{id}:
|
||||
delete:
|
||||
description: Deletes a WireGuard server and cascade-removes its peers and webhooks.
|
||||
parameters:
|
||||
- description: Server ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"204":
|
||||
description: No content
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: Delete a server
|
||||
tags:
|
||||
- servers
|
||||
get:
|
||||
description: Returns a single WireGuard server by its ID.
|
||||
parameters:
|
||||
- description: Server ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/main.Server'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: Get a server
|
||||
tags:
|
||||
- servers
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Updates fields of an existing WireGuard server.
|
||||
parameters:
|
||||
- description: Server ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
- description: Updated server fields
|
||||
in: body
|
||||
name: server
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/main.Server'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/main.Server'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: Update a server
|
||||
tags:
|
||||
- servers
|
||||
/api/servers/{id}/peers:
|
||||
get:
|
||||
description: Returns all peers belonging to a specific WireGuard server.
|
||||
parameters:
|
||||
- description: Server ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/main.Peer'
|
||||
type: array
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: List server peers
|
||||
tags:
|
||||
- peers
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Creates a new WireGuard peer. Applies nftables rules in forward
|
||||
mode or triggers webhooks in standalone mode.
|
||||
parameters:
|
||||
- description: Server ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
- description: Peer configuration
|
||||
in: body
|
||||
name: peer
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/main.Peer'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: Created
|
||||
schema:
|
||||
$ref: '#/definitions/main.Peer'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: Create a peer
|
||||
tags:
|
||||
- peers
|
||||
/api/servers/{id}/stats:
|
||||
get:
|
||||
description: Returns per-server statistics including peer count and webhook
|
||||
count.
|
||||
parameters:
|
||||
- description: Server ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: Get server stats
|
||||
tags:
|
||||
- stats
|
||||
/api/servers/{id}/webhooks:
|
||||
get:
|
||||
description: Returns all webhooks configured for a specific WireGuard server.
|
||||
parameters:
|
||||
- description: Server ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/main.Webhook'
|
||||
type: array
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: List server webhooks
|
||||
tags:
|
||||
- webhooks
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Creates a new webhook configuration for a WireGuard server.
|
||||
parameters:
|
||||
- description: Server ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
- description: Webhook configuration
|
||||
in: body
|
||||
name: webhook
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/main.Webhook'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: Created
|
||||
schema:
|
||||
$ref: '#/definitions/main.Webhook'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: Create a webhook
|
||||
tags:
|
||||
- webhooks
|
||||
/api/settings/smtp:
|
||||
get:
|
||||
description: Returns the current SMTP configuration for email notifications.
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/main.SMTPSettings'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: Get SMTP settings
|
||||
tags:
|
||||
- settings
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Saves or updates SMTP configuration for email notifications.
|
||||
parameters:
|
||||
- description: SMTP configuration
|
||||
in: body
|
||||
name: settings
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/main.SMTPSettings'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/main.SMTPSettings'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: Save SMTP settings
|
||||
tags:
|
||||
- settings
|
||||
/api/stats:
|
||||
get:
|
||||
description: Returns global statistics including total servers, peers, and webhooks.
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
additionalProperties:
|
||||
format: int64
|
||||
type: integer
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: Get global stats
|
||||
tags:
|
||||
- stats
|
||||
/api/webhooks/{id}:
|
||||
delete:
|
||||
description: Deletes a webhook by its ID.
|
||||
parameters:
|
||||
- description: Webhook ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"204":
|
||||
description: No content
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
- BearerAuth: []
|
||||
summary: Delete a webhook
|
||||
tags:
|
||||
- webhooks
|
||||
securityDefinitions:
|
||||
ApiKeyAuth:
|
||||
in: header
|
||||
name: wg-rplane-datadunia
|
||||
type: apiKey
|
||||
BearerAuth:
|
||||
in: header
|
||||
name: Authorization
|
||||
type: apiKey
|
||||
swagger: "2.0"
|
||||
Reference in New Issue
Block a user