diff --git a/Makefile b/Makefile index c8f8483..06e371c 100644 --- a/Makefile +++ b/Makefile @@ -52,7 +52,7 @@ docker-push: docker push $(IMAGE) api-docs: - cd internal/server; swag init --parseDependency --parseInternal --generalInfo api.go + cd internal/server; swag init --propertyStrategy pascalcase --parseDependency --parseInternal --generalInfo api.go $(GOCMD) fmt internal/server/docs/docs.go $(BUILDDIR)/%-amd64: cmd/%/main.go dep phony diff --git a/internal/server/docs/docs.go b/internal/server/docs/docs.go index 6eb3e36..25c0ff7 100644 --- a/internal/server/docs/docs.go +++ b/internal/server/docs/docs.go @@ -1,14 +1,13 @@ -// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT +// 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/alecthomas/template" "github.com/swaggo/swag" ) @@ -16,7 +15,7 @@ var doc = `{ "schemes": {{ marshal .Schemes }}, "swagger": "2.0", "info": { - "description": "{{.Description}}", + "description": "{{escape .Description}}", "title": "{{.Title}}", "contact": { "name": "WireGuard Portal Project", @@ -1203,10 +1202,10 @@ var doc = `{ "gorm.DeletedAt": { "type": "object", "properties": { - "time": { + "Time": { "type": "string" }, - "valid": { + "Valid": { "description": "Valid is true if Time is not NULL", "type": "boolean" } @@ -1215,7 +1214,7 @@ var doc = `{ "server.ApiError": { "type": "object", "properties": { - "message": { + "Message": { "type": "string" } } @@ -1223,16 +1222,16 @@ var doc = `{ "server.PeerDeploymentInformation": { "type": "object", "properties": { - "device": { + "Device": { "type": "string" }, - "deviceIdentifier": { + "DeviceIdentifier": { "type": "string" }, - "identifier": { + "Identifier": { "type": "string" }, - "publicKey": { + "PublicKey": { "type": "string" } } @@ -1240,30 +1239,30 @@ var doc = `{ "server.ProvisioningRequest": { "type": "object", "required": [ - "email", - "identifier" + "Email", + "Identifier" ], "properties": { - "allowedIPsStr": { + "AllowedIPsStr": { "type": "string" }, - "deviceName": { + "DNSStr": { + "type": "string" + }, + "DeviceName": { "description": "DeviceName is optional, if not specified, the configured default device will be used.", "type": "string" }, - "dnsstr": { + "Email": { "type": "string" }, - "email": { + "Identifier": { "type": "string" }, - "identifier": { - "type": "string" - }, - "mtu": { + "Mtu": { "type": "integer" }, - "persistentKeepalive": { + "PersistentKeepalive": { "type": "integer" } } @@ -1271,43 +1270,43 @@ var doc = `{ "users.User": { "type": "object", "required": [ - "email", - "firstname", - "lastname" + "Email", + "Firstname", + "Lastname" ], "properties": { - "createdAt": { + "CreatedAt": { "description": "database internal fields", "type": "string" }, - "deletedAt": { + "DeletedAt": { "$ref": "#/definitions/gorm.DeletedAt" }, - "email": { + "Email": { "description": "required fields", "type": "string" }, - "firstname": { + "Firstname": { "description": "optional fields", "type": "string" }, - "isAdmin": { + "IsAdmin": { "type": "boolean" }, - "lastname": { + "Lastname": { "type": "string" }, - "password": { + "Password": { "description": "optional, integrated password authentication", "type": "string" }, - "phone": { + "Phone": { "type": "string" }, - "source": { + "Source": { "type": "string" }, - "updatedAt": { + "UpdatedAt": { "type": "string" } } @@ -1315,87 +1314,87 @@ var doc = `{ "wireguard.Device": { "type": "object", "required": [ - "deviceName", - "ipsStr", - "privateKey", - "publicKey", - "type" + "DeviceName", + "IPsStr", + "PrivateKey", + "PublicKey", + "Type" ], "properties": { - "createdAt": { + "CreatedAt": { "type": "string" }, - "defaultAllowedIPsStr": { - "description": "comma separated list of IPs that are used in the client config file", - "type": "string" - }, - "defaultEndpoint": { - "description": "Settings that are applied to all peer by default", - "type": "string" - }, - "defaultPersistentKeepalive": { - "type": "integer" - }, - "deviceName": { - "type": "string" - }, - "displayName": { - "type": "string" - }, - "dnsstr": { + "DNSStr": { "description": "comma separated list of the DNS servers of the client, wg-quick addition", "type": "string" }, - "firewallMark": { + "DefaultAllowedIPsStr": { + "description": "comma separated list of IPs that are used in the client config file", + "type": "string" + }, + "DefaultEndpoint": { + "description": "Settings that are applied to all peer by default", + "type": "string" + }, + "DefaultPersistentKeepalive": { "type": "integer" }, - "ipsStr": { + "DeviceName": { + "type": "string" + }, + "DisplayName": { + "type": "string" + }, + "FirewallMark": { + "type": "integer" + }, + "IPsStr": { "description": "comma separated list of the IPs of the client, wg-quick addition", "type": "string" }, - "listenPort": { + "ListenPort": { "type": "integer" }, - "mtu": { + "Mtu": { "description": "the interface MTU, wg-quick addition", "type": "integer" }, - "postDown": { + "PostDown": { "description": "post down script, wg-quick addition", "type": "string" }, - "postUp": { + "PostUp": { "description": "post up script, wg-quick addition", "type": "string" }, - "preDown": { + "PreDown": { "description": "pre down script, wg-quick addition", "type": "string" }, - "preUp": { + "PreUp": { "description": "pre up script, wg-quick addition", "type": "string" }, - "privateKey": { + "PrivateKey": { "description": "Core WireGuard Settings (Interface section)", "type": "string" }, - "publicKey": { + "PublicKey": { "description": "Misc. WireGuard Settings", "type": "string" }, - "routingTable": { + "RoutingTable": { "description": "the routing table, wg-quick addition", "type": "string" }, - "saveConfig": { + "SaveConfig": { "description": "if set to ` + "`" + `true', the configuration is saved from the current state of the interface upon shutdown, wg-quick addition", "type": "boolean" }, - "type": { + "Type": { "type": "string" }, - "updatedAt": { + "UpdatedAt": { "type": "string" } } @@ -1403,71 +1402,75 @@ var doc = `{ "wireguard.Peer": { "type": "object", "required": [ - "deviceName", - "email", - "identifier", - "publicKey" + "DeviceName", + "Email", + "Identifier", + "PublicKey" ], "properties": { - "allowedIPsStr": { + "AllowedIPsSrvStr": { + "description": "a comma separated list of IPs that are used in the server config file", + "type": "string" + }, + "AllowedIPsStr": { "description": "a comma separated list of IPs that are used in the client config file", "type": "string" }, - "createdAt": { + "CreatedAt": { "type": "string" }, - "createdBy": { + "CreatedBy": { "type": "string" }, - "deactivatedAt": { - "type": "string" - }, - "deviceName": { - "type": "string" - }, - "dnsstr": { + "DNSStr": { "description": "comma separated list of the DNS servers for the client", "type": "string" }, - "email": { + "DeactivatedAt": { "type": "string" }, - "endpoint": { + "DeviceName": { "type": "string" }, - "identifier": { - "description": "Identifier AND Email make a WireGuard peer unique", + "Email": { "type": "string" }, - "ignoreGlobalSettings": { - "type": "boolean" + "Endpoint": { + "type": "string" }, - "ipsStr": { + "IPsStr": { "description": "a comma separated list of IPs of the client", "type": "string" }, - "mtu": { + "Identifier": { + "description": "Identifier AND Email make a WireGuard peer unique", + "type": "string" + }, + "IgnoreGlobalSettings": { + "type": "boolean" + }, + "Mtu": { "description": "Global Device Settings (can be ignored, only make sense if device is in server mode)", "type": "integer" }, - "persistentKeepalive": { + "PersistentKeepalive": { "type": "integer" }, - "presharedKey": { + "PresharedKey": { "type": "string" }, - "privateKey": { + "PrivateKey": { "description": "Misc. WireGuard Settings", "type": "string" }, - "publicKey": { + "PublicKey": { "description": "Core WireGuard Settings", "type": "string" }, - "updatedAt": { + "UpdatedAt": { "type": "string" }, - "updatedBy": { + "UpdatedBy": { "type": "string" } } @@ -1513,6 +1516,13 @@ func (s *s) ReadDoc() 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