1542 lines
52 KiB
Go
Raw Normal View History

// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag
package docs
import (
"bytes"
"encoding/json"
"strings"
"text/template"
"github.com/swaggo/swag"
)
var doc = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
2021-04-26 22:00:50 +02:00
"contact": {
"name": "WireGuard Portal Project",
"url": "https://github.com/h44z/wg-portal"
},
"license": {
"name": "MIT",
"url": "https://github.com/h44z/wg-portal/blob/master/LICENSE.txt"
},
2021-04-26 22:00:50 +02:00
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/backend/device": {
2021-04-26 22:00:50 +02:00
"get": {
"security": [
{
"ApiBasicAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"Interface"
],
"summary": "Get the given device",
"parameters": [
{
"type": "string",
"description": "Device Name",
"name": "device",
"in": "query",
2021-04-26 22:00:50 +02:00
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/wireguard.Device"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
},
"put": {
"security": [
{
"ApiBasicAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Interface"
],
"summary": "Updates the given device based on the given device model (UNIMPLEMENTED)",
"parameters": [
{
"type": "string",
"description": "Device Name",
"name": "device",
"in": "query",
2021-04-26 22:00:50 +02:00
"required": true
},
{
"description": "Device Model",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/wireguard.Device"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/wireguard.Device"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
},
"patch": {
"security": [
{
"ApiBasicAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Interface"
],
"summary": "Updates the given device based on the given partial device model (UNIMPLEMENTED)",
"parameters": [
{
"type": "string",
"description": "Device Name",
"name": "device",
"in": "query",
2021-04-26 22:00:50 +02:00
"required": true
},
{
"description": "Device Model",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/wireguard.Device"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/wireguard.Device"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
}
},
"/backend/devices": {
"get": {
"security": [
{
"ApiBasicAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"Interface"
],
"summary": "Get all devices",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/wireguard.Device"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
}
},
"/backend/peer": {
2021-04-26 22:00:50 +02:00
"get": {
"security": [
{
"ApiBasicAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"Peers"
],
"summary": "Retrieves the peer for the given public key",
"parameters": [
{
"type": "string",
"description": "Public Key (Base 64)",
"name": "pkey",
"in": "query",
2021-04-26 22:00:50 +02:00
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/wireguard.Peer"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
},
"put": {
"security": [
{
"ApiBasicAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Peers"
],
"summary": "Updates the given peer based on the given peer model",
"parameters": [
{
"type": "string",
"description": "Public Key",
"name": "pkey",
"in": "query",
2021-04-26 22:00:50 +02:00
"required": true
},
{
"description": "Peer Model",
"name": "peer",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/wireguard.Peer"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/wireguard.Peer"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
},
"delete": {
"security": [
{
"ApiBasicAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"Peers"
],
"summary": "Updates the given peer based on the given partial peer model",
"parameters": [
{
"type": "string",
"description": "Public Key",
"name": "pkey",
"in": "query",
2021-04-26 22:00:50 +02:00
"required": true
}
],
"responses": {
"202": {
"description": "No Content"
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
},
"patch": {
"security": [
{
"ApiBasicAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Peers"
],
"summary": "Updates the given peer based on the given partial peer model",
"parameters": [
{
"type": "string",
"description": "Public Key",
"name": "pkey",
"in": "query",
2021-04-26 22:00:50 +02:00
"required": true
},
{
"description": "Peer Model",
"name": "peer",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/wireguard.Peer"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/wireguard.Peer"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
}
},
"/backend/peers": {
2021-04-26 22:00:50 +02:00
"get": {
"security": [
{
"ApiBasicAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"Peers"
],
"summary": "Retrieves all peers for the given interface",
"parameters": [
{
"type": "string",
"description": "Device Name",
"name": "device",
"in": "query",
2021-04-26 22:00:50 +02:00
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/wireguard.Peer"
}
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
},
"post": {
"security": [
{
"ApiBasicAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Peers"
],
"summary": "Creates a new peer based on the given peer model",
"parameters": [
{
"type": "string",
"description": "Device Name",
"name": "device",
"in": "query",
2021-04-26 22:00:50 +02:00
"required": true
},
{
"description": "Peer Model",
"name": "peer",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/wireguard.Peer"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/wireguard.Peer"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
}
},
"/backend/user": {
"get": {
"security": [
{
"ApiBasicAuth": []
}
],
"produces": [
"application/json"
],
2021-04-26 22:00:50 +02:00
"tags": [
"Users"
],
"summary": "Retrieves user based on given Email",
"parameters": [
{
"type": "string",
"description": "User Email",
"name": "email",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/users.User"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
},
"put": {
"security": [
{
"ApiBasicAuth": []
}
],
2021-04-26 22:00:50 +02:00
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
2021-04-26 22:00:50 +02:00
"tags": [
"Users"
],
"summary": "Updates a user based on the given user model",
"parameters": [
{
"type": "string",
"description": "User Email",
"name": "email",
"in": "query",
"required": true
2021-04-26 22:00:50 +02:00
},
{
"description": "User Model",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/users.User"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/users.User"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
},
"delete": {
"security": [
{
"ApiBasicAuth": []
}
],
"produces": [
"application/json"
],
2021-04-26 22:00:50 +02:00
"tags": [
"Users"
],
"summary": "Deletes the specified user",
"parameters": [
{
"type": "string",
"description": "User Email",
"name": "email",
"in": "query",
"required": true
}
],
"responses": {
"204": {
"description": "No content"
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
},
"patch": {
"security": [
{
"ApiBasicAuth": []
}
],
2021-04-26 22:00:50 +02:00
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
2021-04-26 22:00:50 +02:00
"tags": [
"Users"
],
"summary": "Updates a user based on the given partial user model",
"parameters": [
{
"type": "string",
"description": "User Email",
"name": "email",
"in": "query",
"required": true
2021-04-26 22:00:50 +02:00
},
{
"description": "User Model",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/users.User"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/users.User"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
}
},
2021-04-26 22:00:50 +02:00
"/backend/users": {
"get": {
"security": [
{
"ApiBasicAuth": []
}
],
"produces": [
"application/json"
],
2021-04-26 22:00:50 +02:00
"tags": [
"Users"
],
"summary": "Retrieves all users",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/users.User"
}
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
},
"post": {
"security": [
{
"ApiBasicAuth": []
}
],
2021-04-26 22:00:50 +02:00
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
2021-04-26 22:00:50 +02:00
"tags": [
"Users"
],
"summary": "Creates a new user based on the given user model",
2021-04-26 22:00:50 +02:00
"parameters": [
{
"description": "User Model",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/users.User"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/users.User"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
}
2021-04-26 22:00:50 +02:00
},
"/provisioning/peer": {
2021-04-29 11:23:32 +02:00
"get": {
"security": [
{
"GeneralBasicAuth": []
}
],
"produces": [
"text/plain"
],
"tags": [
"Provisioning"
],
"summary": "Retrieves the peer config for the given public key",
"parameters": [
{
"type": "string",
"description": "Public Key (Base 64)",
"name": "pkey",
"in": "query",
2021-04-29 11:23:32 +02:00
"required": true
}
],
"responses": {
"200": {
"description": "The WireGuard configuration file",
"schema": {
"type": "string"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
}
},
"/provisioning/peers": {
"get": {
2021-04-26 22:00:50 +02:00
"security": [
{
"GeneralBasicAuth": []
}
],
"produces": [
"application/json"
2021-04-26 22:00:50 +02:00
],
"tags": [
"Provisioning"
],
"summary": "Retrieves all active peers for the given email address",
2021-04-26 22:00:50 +02:00
"parameters": [
{
"type": "string",
"description": "Email Address",
"name": "email",
"in": "query",
"required": true
2021-04-26 22:00:50 +02:00
}
],
"responses": {
"200": {
"description": "All active WireGuard peers",
2021-04-26 22:00:50 +02:00
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/server.PeerDeploymentInformation"
}
2021-04-26 22:00:50 +02:00
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
},
"post": {
2021-04-26 22:00:50 +02:00
"security": [
{
"GeneralBasicAuth": []
}
],
"consumes": [
2021-04-29 11:23:32 +02:00
"application/json"
2021-04-26 22:00:50 +02:00
],
"produces": [
"text/plain"
],
2021-04-26 22:00:50 +02:00
"tags": [
"Provisioning"
],
"summary": "Creates the requested peer config and returns the config file",
2021-04-26 22:00:50 +02:00
"parameters": [
{
"description": "Provisioning Request Model",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/server.ProvisioningRequest"
}
2021-04-26 22:00:50 +02:00
}
],
"responses": {
"200": {
"description": "The WireGuard configuration file",
2021-04-26 22:00:50 +02:00
"schema": {
"type": "string"
2021-04-26 22:00:50 +02:00
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/server.ApiError"
}
}
}
}
}
},
"definitions": {
"gorm.DeletedAt": {
"type": "object",
"properties": {
"Time": {
"type": "string"
},
"Valid": {
"description": "Valid is true if Time is not NULL",
"type": "boolean"
}
}
},
"server.ApiError": {
"type": "object",
"properties": {
"Message": {
"type": "string"
}
}
},
2021-04-29 11:23:32 +02:00
"server.PeerDeploymentInformation": {
"type": "object",
"properties": {
"Device": {
2021-04-29 11:23:32 +02:00
"type": "string"
},
"DeviceIdentifier": {
2021-04-29 11:23:32 +02:00
"type": "string"
},
"Identifier": {
2021-04-29 11:23:32 +02:00
"type": "string"
},
"PublicKey": {
2021-04-29 11:23:32 +02:00
"type": "string"
}
}
},
2021-04-26 22:00:50 +02:00
"server.ProvisioningRequest": {
"type": "object",
"required": [
"Email",
"Identifier"
2021-04-26 22:00:50 +02:00
],
"properties": {
"AllowedIPsStr": {
2021-04-26 22:00:50 +02:00
"type": "string"
},
"DNSStr": {
2021-04-26 22:00:50 +02:00
"type": "string"
},
"DeviceName": {
"description": "DeviceName is optional, if not specified, the configured default device will be used.",
2021-04-26 22:00:50 +02:00
"type": "string"
},
"Email": {
2021-04-26 22:00:50 +02:00
"type": "string"
},
"Identifier": {
2021-04-26 22:00:50 +02:00
"type": "string"
},
"Mtu": {
2021-04-26 22:00:50 +02:00
"type": "integer"
},
"PersistentKeepalive": {
2021-04-26 22:00:50 +02:00
"type": "integer"
}
}
},
"users.User": {
"type": "object",
"required": [
"Email",
"Firstname",
"Lastname"
],
"properties": {
"CreatedAt": {
"description": "database internal fields",
"type": "string"
},
"DeletedAt": {
"$ref": "#/definitions/gorm.DeletedAt"
},
"Email": {
"description": "required fields",
"type": "string"
},
"Firstname": {
"description": "optional fields",
"type": "string"
},
"IsAdmin": {
"type": "boolean"
},
"Lastname": {
"type": "string"
},
"Password": {
"description": "optional, integrated password authentication",
"type": "string"
},
"Phone": {
"type": "string"
},
"Source": {
"type": "string"
},
"UpdatedAt": {
"type": "string"
}
}
2021-04-26 22:00:50 +02:00
},
"wireguard.Device": {
"type": "object",
"required": [
"DeviceName",
"IPsStr",
"PrivateKey",
"PublicKey",
"Type"
2021-04-26 22:00:50 +02:00
],
"properties": {
"CreatedAt": {
"type": "string"
},
"DNSStr": {
"description": "comma separated list of the DNS servers of the client, wg-quick addition",
2021-04-26 22:00:50 +02:00
"type": "string"
},
"DefaultAllowedIPsStr": {
2021-04-26 22:00:50 +02:00
"description": "comma separated list of IPs that are used in the client config file",
"type": "string"
},
"DefaultEndpoint": {
2021-04-26 22:00:50 +02:00
"description": "Settings that are applied to all peer by default",
"type": "string"
},
"DefaultPersistentKeepalive": {
2021-04-26 22:00:50 +02:00
"type": "integer"
},
"DeviceName": {
2021-04-26 22:00:50 +02:00
"type": "string"
},
"DisplayName": {
2021-04-26 22:00:50 +02:00
"type": "string"
},
"FirewallMark": {
2021-04-26 22:00:50 +02:00
"type": "integer"
},
"IPsStr": {
2021-04-26 22:00:50 +02:00
"description": "comma separated list of the IPs of the client, wg-quick addition",
"type": "string"
},
"ListenPort": {
2021-04-26 22:00:50 +02:00
"type": "integer"
},
"Mtu": {
2021-04-26 22:00:50 +02:00
"description": "the interface MTU, wg-quick addition",
"type": "integer"
},
"PostDown": {
2021-04-26 22:00:50 +02:00
"description": "post down script, wg-quick addition",
"type": "string"
},
"PostUp": {
2021-04-26 22:00:50 +02:00
"description": "post up script, wg-quick addition",
"type": "string"
},
"PreDown": {
2021-04-26 22:00:50 +02:00
"description": "pre down script, wg-quick addition",
"type": "string"
},
"PreUp": {
2021-04-26 22:00:50 +02:00
"description": "pre up script, wg-quick addition",
"type": "string"
},
"PrivateKey": {
2021-04-26 22:00:50 +02:00
"description": "Core WireGuard Settings (Interface section)",
"type": "string"
},
"PublicKey": {
2021-04-26 22:00:50 +02:00
"description": "Misc. WireGuard Settings",
"type": "string"
},
"RoutingTable": {
2021-04-26 22:00:50 +02:00
"description": "the routing table, wg-quick addition",
"type": "string"
},
"SaveConfig": {
2021-04-26 22:00:50 +02:00
"description": "if set to ` + "`" + `true', the configuration is saved from the current state of the interface upon shutdown, wg-quick addition",
"type": "boolean"
},
"Type": {
2021-04-26 22:00:50 +02:00
"type": "string"
},
"UpdatedAt": {
2021-04-26 22:00:50 +02:00
"type": "string"
}
}
},
"wireguard.Peer": {
"type": "object",
"required": [
"DeviceName",
"Email",
"Identifier",
"PublicKey"
2021-04-26 22:00:50 +02:00
],
"properties": {
"AllowedIPsSrvStr": {
"description": "a comma separated list of IPs that are used in the server config file",
"type": "string"
},
"AllowedIPsStr": {
2021-04-26 22:00:50 +02:00
"description": "a comma separated list of IPs that are used in the client config file",
"type": "string"
},
"CreatedAt": {
2021-04-26 22:00:50 +02:00
"type": "string"
},
"CreatedBy": {
2021-04-26 22:00:50 +02:00
"type": "string"
},
"DNSStr": {
"description": "comma separated list of the DNS servers for the client",
2021-04-26 22:00:50 +02:00
"type": "string"
},
"DeactivatedAt": {
2021-04-26 22:00:50 +02:00
"type": "string"
},
"DeviceName": {
"type": "string"
},
"Email": {
2021-04-26 22:00:50 +02:00
"type": "string"
},
"Endpoint": {
2021-04-26 22:00:50 +02:00
"type": "string"
},
"IPsStr": {
"description": "a comma separated list of IPs of the client",
2021-04-26 22:00:50 +02:00
"type": "string"
},
"Identifier": {
2021-04-26 22:00:50 +02:00
"description": "Identifier AND Email make a WireGuard peer unique",
"type": "string"
},
"IgnoreGlobalSettings": {
2021-04-26 22:00:50 +02:00
"type": "boolean"
},
"Mtu": {
2021-04-26 22:00:50 +02:00
"description": "Global Device Settings (can be ignored, only make sense if device is in server mode)",
"type": "integer"
},
"PersistentKeepalive": {
2021-04-26 22:00:50 +02:00
"type": "integer"
},
"PresharedKey": {
2021-04-26 22:00:50 +02:00
"type": "string"
},
"PrivateKey": {
2021-04-26 22:00:50 +02:00
"description": "Misc. WireGuard Settings",
"type": "string"
},
"PublicKey": {
2021-04-26 22:00:50 +02:00
"description": "Core WireGuard Settings",
"type": "string"
},
"UpdatedAt": {
2021-04-26 22:00:50 +02:00
"type": "string"
},
"UpdatedBy": {
2021-04-26 22:00:50 +02:00
"type": "string"
}
}
}
},
"securityDefinitions": {
"ApiBasicAuth": {
"type": "basic"
2021-04-26 22:00:50 +02:00
},
"GeneralBasicAuth": {
"type": "basic"
}
}
}`
type swaggerInfo struct {
Version string
Host string
BasePath string
Schemes []string
Title string
Description string
}
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = swaggerInfo{
Version: "1.0",
Host: "",
BasePath: "/api/v1",
Schemes: []string{},
Title: "WireGuard Portal API",
Description: "WireGuard Portal API for managing users and peers.",
}
type s struct{}
func (s *s) ReadDoc() string {
sInfo := SwaggerInfo
sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)
t, err := template.New("swagger_info").Funcs(template.FuncMap{
"marshal": func(v interface{}) string {
a, _ := json.Marshal(v)
return string(a)
},
"escape": func(v interface{}) string {
// escape tabs
str := strings.Replace(v.(string), "\t", "\\t", -1)
// replace " with \", and if that results in \\", replace that with \\\"
str = strings.Replace(str, "\"", "\\\"", -1)
return strings.Replace(str, "\\\\\"", "\\\\\\\"", -1)
},
}).Parse(doc)
if err != nil {
return doc
}
var tpl bytes.Buffer
if err := t.Execute(&tpl, sInfo); err != nil {
return doc
}
return tpl.String()
}
func init() {
swag.Register(swag.Name, &s{})
}