handler

package
Version: v0.0.0-...-0bc30a8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2021 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticationHandler

func AuthenticationHandler(blocking types.AuthHandler) gin.HandlerFunc

AuthenticationHandler acts as middleware between gin and the controllers. It can block the process if the user is not authenticated or let him pass if he is. If the blocking type is set to types.NonBlocking it will let user pass even if he is not authenticated. In both cases (types.Blocking/types.NonBlocking) it will try to set the model.User in the gin context

func BearerDELETEHandler

func BearerDELETEHandler(ctx *gin.Context)

*

* @api {delete} /system/settings/bearer/:id Delete an authentication token by ID
* @apiVersion 1.0.0
* @apiName bearerDELETEHandler
* @apiGroup system
* @apiPermission user
*
* @apiExample Usage (curl):
* curl -s -X DELETE http://localhost:8080/system/settings/bearer/1
*
* @apiSuccess {String} type Will be set to <code>success</code>.
*
* @apiSuccessExample Response
*     HTTP/1.1. 200 OK
*     {
*       "type": "success"
*     }
*
* @apiError {String} type Will be set to <code>error</code>.
* @apiError {String} msg  Contains more details about the error itself.
*
* @apiErrorExample Authentication error
*     HTTP/1.1 403 Forbidden
*     {
*       "type": "error",
*       "msg": "no user found for session"
*     }
*
* @apiErrorExample Server error
*     HTTP/1.1 500 Internal Server Error
*     {
*       "type": "error",
*       "msg": "too many connections"
*     }

func BearerGETHandler

func BearerGETHandler(ctx *gin.Context)

*

* @api {get} /system/settings/bearer Fetch all tokens related to the user account
* @apiVersion 1.0.0
* @apiName bearerGETHandler
* @apiGroup system
* @apiPermission user
*
* @apiExample Usage (curl):
* curl -s http://localhost:8080/system/settings/bearer
*
* @apiSuccessExample Response
*     HTTP/1.1. 200 OK
*     [{
*       "id": "1",
*       "createdAt": "2020-07-21T15:34:59.626159Z",
*       "userId": "1",
*       "token": "s3cr3tt0k3n",
*       "level": "0"
*     }]
*
* @apiError {String} type Will be set to <code>error</code>.
* @apiError {String} msg  Contains more details about the error itself.
*
* @apiErrorExample Authentication error
*     HTTP/1.1 403 Forbidden
*     {
*       "type": "error",
*       "msg": "no user found for session"
*     }
*
* @apiErrorExample Server error
*     HTTP/1.1 500 Internal Server Error
*     {
*       "type": "error",
*       "msg": "too many connections"
*     }

func ConnectionHandler

func ConnectionHandler(ctx *gin.Context)

*

* @api {get} /connections/ Fetch connections
* @apiVersion 1.0.0
* @apiName connectionHandler
* @apiGroup connection
* @apiPermission user
*
* @apiParam {Number} [minutes] Select entries from the last X minutes.
* @apiParam {Number} [hours] Select entries from the last X hours.
* @apiParam {Number} [days] Select entries from the last X days.
* @apiParam {Number} [limit] Select a maximum of X entries.
*
* @apiExample Usage (curl):
* curl -s http://localhost:8080/connections/
*
* @apiSuccess {Number} id                  The connection identifier.
* @apiSuccess {Date}   updatedAt           The last time the connection was updated/used.
* @apiSuccess {Number} count               How often a connection attempt occurred.
* @apiSuccess {Object} source              Information about the source endpoint.
* @apiSuccess {Object} destination         Information about the destination endpoint.
* @apiSuccess {Object} transportProtocol   The used transport protocol.
* @apiSuccess {Object} applicationProtocol The used application protocol.
*
* @apiSuccessExample Response
*     HTTP/1.1. 200 OK
*     [{
*       "id": 48,
*       "updatedAt": "2020-06-17T15:55:18.638668Z",
*       "count": 2,
*       "source": {
*         "id": 2,
*         "createdAt": "2020-06-06T21:39:11.595587Z",
*         "updatedAt": "2020-06-17T15:55:18.422093Z",
*         "ip": "10.0.66.50",
*         "macAddress": "xx:xx:xx:xx:xx:xx",
*         "reverseDNS": "",
*         "netBIOS": "",
*         "country": "",
*         "europeanUnion": false,
*         "anonymousProxy": false,
*         "satelliteProvider": false
*       },
*       "destination": {
*         "id": 22,
*         "createdAt": "2020-06-06T21:53:20.189271Z",
*         "updatedAt": "2020-06-17T15:55:18.518903Z",
*         "ip": "138.201.81.199",
*         "macAddress": "",
*         "reverseDNS": "apollo.archlinux.org.",
*         "netBIOS": "",
*         "country": "DE",
*         "europeanUnion": true,
*         "anonymousProxy": false,
*         "satelliteProvider": false
*       },
*       "transportProtocol": {
*         "id": 3,
*         "createdAt": "2020-06-06T21:39:07.808221Z",
*         "name": "TCP"
*       },
*       "applicationProtocol": {
*         "id": 5,
*         "createdAt": "2020-06-06T21:39:15.249659Z",
*         "name": "HTTP"
*       }
*     }]
*
* @apiError {String} type Will be set to <code>error</code>.
* @apiError {String} msg  Contains more details about the error itself.
*
* @apiErrorExample Authentication error
*     HTTP/1.1 403 Forbidden
*     {
*       "type": "error",
*       "msg": "no user found for session"
*     }
*
* @apiErrorExample Server error
*     HTTP/1.1 500 Internal Server Error
*     {
*       "type": "error",
*       "msg": "too many connections"
*     }

func ExceptionCreateHandler

func ExceptionCreateHandler(ctx *gin.Context)

* * @api {post} /exceptions/pattern/:patternID Create or update exception attributes

* @apiVersion 1.0.0
* @apiName exceptionCreateHandler
* @apiGroup exception
* @apiPermission user
*
* @apiParam {Number}  patternID The pattern identifier.
* @apiParam {Boolean} [drop]    Should the pattern drop network traffic.
* @apiParam {Boolean} [alert]   Should the pattern alert if triggered.
*
* @apiExample Usage (curl):
* curl -s -X POST -d '{drop: true}' http://localhost:8080/exceptions/pattern/1
*
* @apiSuccess {Number}  id        The exception identifier.
* @apiSuccess {Date}    createdAt Exception creation timestamp.
* @apiSuccess {Date}    updatedAt The last time the exception was updated.
* @apiSuccess {Number}  type      The exception type identifier.
* @apiSuccess {Boolean} alert     If the exception should trigger a notification in the future.
* @apiSuccess {Boolean} drop      If the exception should drop network traffic.
* @apiSuccess {Number}  patternId The pattern identifier.
*
* @apiSuccessExample Response
*     HTTP/1.1. 200 OK
*     {
*       "id": 2,
*       "createdAt": "2020-06-07T14:10:32.559505Z",
*       "updatedAt": "2020-06-07T14:10:32.559505Z",
*       "type": 0,
*       "alert": true,
*       "drop": true,
*       "patternId": 1234
*     }
*
* @apiError {String} type Will be set to <code>error</code>.
* @apiError {String} msg  Contains more details about the error itself.
*
* @apiErrorExample Authentication error
*     HTTP/1.1 403 Forbidden
*     {
*       "type": "error",
*       "msg": "no user found for session"
*     }
*
* @apiErrorExample Server error
*     HTTP/1.1 500 Internal Server Error
*     {
*       "type": "error",
*       "msg": "too many connections"
*     }

func ExceptionHandler

func ExceptionHandler(ctx *gin.Context)

*

* @api {get} /exceptions/ Fetch exceptions
* @apiVersion 1.0.0
* @apiName exceptionHandler
* @apiGroup exception
* @apiPermission user
*
* @apiExample Usage (curl):
* curl -s http://localhost:8080/exceptions/
*
* @apiSuccess {Number}  id        The exception identifier.
* @apiSuccess {Date}    createdAt Exception creation timestamp.
* @apiSuccess {Date}    updatedAt The last time the exception was updated.
* @apiSuccess {Number}  type      The exception type identifier.
* @apiSuccess {Boolean} alert     If the exception should trigger a notification in the future.
* @apiSuccess {Boolean} drop      If the exception should drop network traffic.
* @apiSuccess {String}  pattern   The actual rule or pattern which is affected by the exception.
*
* @apiSuccessExample Response
*     HTTP/1.1. 200 OK
*     [{
*       "id": 2,
*       "createdAt": "2020-06-07T14:10:32.559505Z",
*       "updatedAt": "2020-06-07T14:10:32.559505Z",
*       "type": 0,
*       "alert": true,
*       "drop": false,
*       "pattern": "raw.githubusercontent.com"
*     }]
*
* @apiError {String} type Will be set to <code>error</code>.
* @apiError {String} msg  Contains more details about the error itself.
*
* @apiErrorExample Authentication error
*     HTTP/1.1 403 Forbidden
*     {
*       "type": "error",
*       "msg": "no user found for session"
*     }
*
* @apiErrorExample Server error
*     HTTP/1.1 500 Internal Server Error
*     {
*       "type": "error",
*       "msg": "too many connections"
*     }

func ExceptionPatternHandler

func ExceptionPatternHandler(ctx *gin.Context)

* * @api {get} /exceptions/pattern/:patternID Fetch exception

* @apiVersion 1.0.0
* @apiName exceptionPatternHandler
* @apiGroup exception
* @apiPermission user
*
* @apiExample Usage (curl):
* curl -s http://localhost:8080/exceptions/pattern/1
*
* @apiSuccess {Number}  id        The exception identifier.
* @apiSuccess {Date}    createdAt Exception creation timestamp.
* @apiSuccess {Date}    updatedAt The last time the exception was updated.
* @apiSuccess {Number}  type      The exception type identifier.
* @apiSuccess {Boolean} alert     If the exception should trigger a notification in the future.
* @apiSuccess {Boolean} drop      If the exception should drop network traffic.
* @apiSuccess {String}  pattern   The actual rule or pattern which is affected by the exception.
*
* @apiSuccessExample Response
*     HTTP/1.1. 200 OK
*     {
*       "id": 2,
*       "createdAt": "2020-06-07T14:10:32.559505Z",
*       "updatedAt": "2020-06-07T14:10:32.559505Z",
*       "type": 0,
*       "alert": true,
*       "drop": false,
*       "pattern": "raw.githubusercontent.com"
*     }
*
* @apiError {String} type Will be set to <code>error</code>.
* @apiError {String} msg  Contains more details about the error itself.
*
* @apiErrorExample Authentication error
*     HTTP/1.1 403 Forbidden
*     {
*       "type": "error",
*       "msg": "no user found for session"
*     }
*
* @apiErrorExample Server error
*     HTTP/1.1 500 Internal Server Error
*     {
*       "type": "error",
*       "msg": "too many connections"
*     }

func InterfacesGETHandler

func InterfacesGETHandler(ctx *gin.Context)

*

* @api {get} /system/settings/interfaces Fetch all registered network interfaces
* @apiVersion 1.0.0
* @apiName interfacesGETHandler
* @apiGroup system
* @apiPermission user
*
* @apiExample Usage (curl):
* curl -s http://localhost:8080/system/settings/network/interfaces
*
* @apiSuccess {String}   type Will be set to <code>success</code>.
* @apiSuccess {Object[]} data List of available network interfaces
* @apiSuccess {Number}   data.id Database identifier
* @apiSuccess {Date}     data.createdAt Database creation timestamp
* @apiSuccess {Date}     data.updatedAt Database updated timestamp
* @apiSuccess {String}   data.name Network interface name
* @apiSuccess {String}   data.networkId Network identifier
* @apiSuccess {Boolean}  data.wirelessCard Set to <code>true</code> if it is a wirless card
*
* @apiSuccessExample Response
*     HTTP/1.1. 200 OK
*     {
*       "type": "success",
*       "data": [{
*         "id": 1,
*         "network": "10.0.67.254/24",
*         "createdAt": "...",
*         "updatedAt": "...",
*         "name": "eth0",
*         "networkId": 1,
*         "wirelessCard": false
*       }]
*     }
*
* @apiError {String} type Will be set to <code>error</code>.
* @apiError {String} msg  Contains more details about the error itself.
*
* @apiErrorExample Authentication error
*     HTTP/1.1 403 Forbidden
*     {
*       "type": "error",
*       "msg": "no user found for session"
*     }
*
* @apiErrorExample Server error
*     HTTP/1.1 500 Internal Server Error
*     {
*       "type": "error",
*       "msg": "too many connections"
*     }

func InterfacesPOSTHandler

func InterfacesPOSTHandler(ctx *gin.Context)

func Logger

func Logger(customLogger zerolog.Logger)

func NetworksDELETEHandler

func NetworksDELETEHandler(ctx *gin.Context)

func NetworksGETHandler

func NetworksGETHandler(ctx *gin.Context)

*

* @api {get} /system/settings/networks Fetch all available networks and configuartion options
* @apiVersion 1.0.0
* @apiName networksGETHandler
* @apiGroup system
* @apiPermission user
*
* @apiExample Usage (curl):
* curl -s http://localhost:8080/system/settings/networks
*
* @apiSuccess {String}   type Will be set to <code>success</code>.
* @apiSuccess {Object[]} data List of available network configuration objects
* @apiSuccess {Number}   data.id Database identifier
* @apiSuccess {Date}     data.createdAt Database creation timestamp
* @apiSuccess {Date}     data.updatedAt Database updated timestamp
* @apiSuccess {String}   data.name Network object name
* @apiSuccess {String}   data.network Network mask and range (CIDR)
* @apiSuccess {Boolean}  data.dhcp Set to <code>true</code> if a DHCP server is used in the network
* @apiSuccess {Boolean}  data.dns Set to <code>true</code> if a DNS server is used in the network
*
* @apiSuccessExample Response
*     HTTP/1.1. 200 OK
*     {
*       "type": "success",
*       "data": [{
*         "id": 1,
*         "network": "10.0.67.254/24",
*         "createdAt": "...",
*         "updatedAt": "...",
*         "name": "default",
*         "network": "10.0.66.0/24",
*         "dhcp": true,
*         "dns": true
*       }]
*     }
*
* @apiError {String} type Will be set to <code>error</code>.
* @apiError {String} msg  Contains more details about the error itself.
*
* @apiErrorExample Authentication error
*     HTTP/1.1 403 Forbidden
*     {
*       "type": "error",
*       "msg": "no user found for session"
*     }
*
* @apiErrorExample Server error
*     HTTP/1.1 500 Internal Server Error
*     {
*       "type": "error",
*       "msg": "too many connections"
*     }

func NetworksPOSTHandler

func NetworksPOSTHandler(ctx *gin.Context)

func NotificationHandler

func NotificationHandler(ctx *gin.Context)

*

* @api {get} /notifications/ Fetch notifications
* @apiVersion 1.0.0
* @apiName notificationHandler
* @apiGroup notification
* @apiPermission user
*
* @apiParam {Boolean} [reviewed] Filter for reviewed notifications. If not defined it will return reviewed and un-reviewed content.
*
* @apiExample Usage (curl):
* curl -s http://localhost:8080/notifications/
*
* @apiSuccess {Number}  id           The notification identifier.
* @apiSuccess {Date}    createdAt    Notification creation timestamp.
* @apiSuccess {Date}    updatedAt    The last time the notification was updated.
* @apiSuccess {Number}  triggerCount How often the notification was triggered.
* @apiSuccess {Number}  type         The notification type identifier.
* @apiSuccess {Boolean} reviewed     If the notification was reviewed.
* @apiSuccess {String}  pattern      The actual rule or pattern which is responsible for the notification.
*
* @apiSuccessExample Response
*     HTTP/1.1. 200 OK
*     [{
*       "id": 316,
*       "createdAt": "2020-06-27T23:06:21.338453Z",
*       "updatedAt": "2020-07-17T10:06:46.223833Z",
*       "triggerCount": 202,
*       "type": 49,
*       "reviewed": true,
*       "pattern": "googleads.g.doubleclick.net"
*     }]
*
* @apiError {String} type Will be set to <code>error</code>.
* @apiError {String} msg  Contains more details about the error itself.
*
* @apiErrorExample Authentication error
*     HTTP/1.1 403 Forbidden
*     {
*       "type": "error",
*       "msg": "no user found for session"
*     }
*
* @apiErrorExample Server error
*     HTTP/1.1 500 Internal Server Error
*     {
*       "type": "error",
*       "msg": "too many connections"
*     }

func NotificationUpdateHandler

func NotificationUpdateHandler(ctx *gin.Context)

* * @api {post} /notifications/:id/reviewed/:action Set notification attribute reviewed

* @apiVersion 1.0.0
* @apiName notificationUpdateHandler
* @apiGroup notification
* @apiPermission user
*
* @apiParam {Number} id Notification identifier
* @apiParam {Boolean} action Specify either <code>true</code> or <code>false</code> as action.
*
* @apiExample Usage (curl):
* curl -s -X POST http://localhost:8080/notifications/1/reviewed/true
*
* @apiSuccess {Number}  id           The notification identifier.
* @apiSuccess {Date}    createdAt    Notification creation timestamp.
* @apiSuccess {Date}    updatedAt    The last time the notification was updated.
* @apiSuccess {Number}  triggerCount How often the notification was triggered.
* @apiSuccess {Number}  type         The notification type identifier.
* @apiSuccess {Boolean} reviewed     If the notification was reviewed.
* @apiSuccess {String}  pattern      The actual rule or pattern which is responsible for the notification.
*
* @apiSuccessExample Response
*     HTTP/1.1. 200 OK
*     {
*       "id": 316,
*       "createdAt": "2020-06-27T23:06:21.338453Z",
*       "updatedAt": "2020-07-17T10:06:46.223833Z",
*       "triggerCount": 202,
*       "type": 49,
*       "reviewed": true,
*       "pattern": "googleads.g.doubleclick.net"
*     }
*
* @apiError {String} type Will be set to <code>error</code>.
* @apiError {String} msg  Contains more details about the error itself.
*
* @apiErrorExample Authentication error
*     HTTP/1.1 403 Forbidden
*     {
*       "type": "error",
*       "msg": "no user found for session"
*     }
*
* @apiErrorExample Server error
*     HTTP/1.1 500 Internal Server Error
*     {
*       "type": "error",
*       "msg": "too many connections"
*     }

func PatternByIDHandler

func PatternByIDHandler(ctx *gin.Context)

*

* @api {get} /patterns/:id Fetch a specific pattern by ID
* @apiVersion 1.0.0
* @apiName patternByIDHandler
* @apiGroup pattern
* @apiPermission user
*
* @apiParam {Number} id Select a pattern by the specified identifier.
*
* @apiExample Usage (curl):
* curl -s http://localhost:8080/patterns/1
*
* @apiSuccess {Number} id        The pattern identifier.
* @apiSuccess {Date}   updatedAt The last time the pattern was updated.
* @apiSuccess {String} raw       The raw pattern.
* @apiSuccess {Boolean} ip       Set to <code>true</code if it is an IP address.
* @apiSuccess {Boolean} url      Set to <code>true</code if it is a DNS address.
* @apiSuccess {Boolean} url_path Set to <code>true</code if it is a DNS address with path.
*
* @apiSuccessExample Response
*     HTTP/1.1. 200 OK
*     {
*       "id": 1,
*       "updatedAt": "2020-09-03 10:59:45.149726",
*       "raw": "allegra.1.p2l.info",
*       "ip": false,
*       "url": true,
*       "url_path": false
*     }
*
* @apiError {String} type Will be set to <code>error</code>.
* @apiError {String} msg  Contains more details about the error itself.
*
* @apiErrorExample Authentication error
*     HTTP/1.1 403 Forbidden
*     {
*       "type": "error",
*       "msg": "no user found for session"
*     }
*
* @apiErrorExample Server error
*     HTTP/1.1 500 Internal Server Error
*     {
*       "type": "error",
*       "msg": "too many connections"
*     }

func PatternCategoryHandler

func PatternCategoryHandler(ctx *gin.Context)

func PatternChangeCategoryHandler

func PatternChangeCategoryHandler(ctx *gin.Context)

func PortalEventHandler

func PortalEventHandler(ctx *gin.Context)

*

* @api {get} /portal/events Fetch portal events
* @apiVersion 1.0.0
* @apiName portalEventHandler
* @apiGroup portal
* @apiPermission user
*
* @apiExample Usage (curl):
* curl -s http://localhost:8080/portal/events
*
* @apiSuccess {Number} id         The local event identifier.
* @apiSuccess {Number} pid        The remote portal identifier.
* @apiSuccess {Date}   createdAt  Event creation timestamp.
* @apiSuccess {Date}   updatedAt  The last time the event was updated.
* @apiSuccess {Number} type       The event type identifier.
* @apiSuccess {Object} [message]  The JSON event message.
* @apiSuccess {String} poolUuid   Unique pool identifier.
* @apiSuccess {Number} [clientId] Remote client identifier.
*
* @apiSuccessExample Response
*     HTTP/1.1. 200 OK
*     [{
*       "id": 1,
*       "pid": 200,
*       "createdAt": "2020-06-07T14:10:32.559505Z",
*       "updatedAt": "2020-06-07T14:10:32.559505Z",
*       "type": 0,
*       "message": {
*         "id":0,
*         "createdAt": "2020-08-10T13:07:10.080933166+02:00",
*         "updatedAt": "2020-08-10T13:07:10.080933451+02:00",
*         "fingerprint": "SHA256:...",
*         "serializedPublicKey":"-----BEGIN PUBLIC KEY-----\n\n..\n-----END PUBLIC KEY-----"
*       },
*       "poolUuid": "4b735eb2-c229-4b9f-a2c2-63fac8f01bbc",
*       "clientId": 3
*     }]
*
* @apiError {String} type Will be set to <code>error</code>.
* @apiError {String} msg  Contains more details about the error itself.
*
* @apiErrorExample Authentication error
*     HTTP/1.1 403 Forbidden
*     {
*       "type": "error",
*       "msg": "no user found for session"
*     }
*
* @apiErrorExample Server error
*     HTTP/1.1 500 Internal Server Error
*     {
*       "type": "error",
*       "msg": "too many connections"
*     }

func PortalPushMembershipHandler

func PortalPushMembershipHandler(ctx *gin.Context)

func ProfileHandler

func ProfileHandler(ctx *gin.Context)

func ProfileR2ByIDHandler

func ProfileR2ByIDHandler(ctx *gin.Context)

func ProfileR2Handler

func ProfileR2Handler(ctx *gin.Context)

func SettingsPTLGETHandler

func SettingsPTLGETHandler(ctx *gin.Context)

func SettingsPTLPOSTHandler

func SettingsPTLPOSTHandler(ctx *gin.Context)

func SettingsWLGETHandler

func SettingsWLGETHandler(ctx *gin.Context)

func SettingsWLPOSTHandler

func SettingsWLPOSTHandler(ctx *gin.Context)

func SettingsWifiAPGETHandler

func SettingsWifiAPGETHandler(ctx *gin.Context)

func SettingsWifiAPPOSTHandler

func SettingsWifiAPPOSTHandler(ctx *gin.Context)

func SettingsWifiSTAGETHandler

func SettingsWifiSTAGETHandler(ctx *gin.Context)

func SettingsWifiSTAPOSTHandler

func SettingsWifiSTAPOSTHandler(ctx *gin.Context)

func SystemInfoHandler

func SystemInfoHandler(ctx *gin.Context)

*

* @api {get} /system/info/ Fetch system information
* @apiVersion 1.0.0
* @apiName systemInfoHandler
* @apiGroup system
* @apiPermission user
*
* @apiExample Usage (curl):
* curl -s http://localhost:8080/system/info/
*
* @apiSuccess {String} type Will be set to <code>success</code>.
* @apiSuccess {Object} data Checkout the following external documentation for <ul><li><a href="https://pkg.go.dev/github.com/c9s/goprocinfo/linux?tab=doc#CPUInfo">CpuInfo</a></li><li><a href="https://pkg.go.dev/github.com/c9s/goprocinfo/linux?tab=doc#MemInfo">MemInfo</a></li><li><a href="https://pkg.go.dev/github.com/c9s/goprocinfo/linux?tab=doc#LoadAvg">LoadAvg</a></li></ul>
*
* @apiSuccessExample Response
*     HTTP/1.1. 200 OK
*     {
*       "type":"success",
*       "data":{
*         "Version": "alpha-20200908",
*         "CpuInfo":{
*           [...]
*         },
*         "LoadAvg":{
*           [...]
*         },
*         "MemInfo":{
*           [...]
*         },
*         "Uptime":{
*           [...]
*         }
*       }
*     }
*
* @apiError {String} type Will be set to <code>error</code>.
* @apiError {String} msg  Contains more details about the error itself.
*
* @apiErrorExample Authentication error
*     HTTP/1.1 403 Forbidden
*     {
*       "type": "error",
*       "msg": "no user found for session"
*     }
*
* @apiErrorExample Server error
*     HTTP/1.1 500 Internal Server Error
*     {
*       "type": "error",
*       "msg": "too many connections"
*     }

func SystemStatisticsHandler

func SystemStatisticsHandler(ctx *gin.Context)

*

* @api {get} /system/statistics/ Fetch system statistics
* @apiVersion 1.0.0
* @apiName systemStatisticsHandler
* @apiGroup system
* @apiPermission user
*
* @apiExample Usage (curl):
* curl -s http://localhost:8080/system/statistics/
*
* @apiSuccess {String} type Will be set to <code>success</code>.
* @apiSuccess {Object} data <pre>[{"id": Number, "key": String, "Count": Number}]</pre>
*
* @apiSuccessExample Response
*     HTTP/1.1. 200 OK
*     {
*       "type": "success",
*       "data": [
*         {
*           "id": 5,
*           "key": "DroppedConnectionsStatistic",
*           "count": 57
*         },
*         {
*           "id": 2,
*           "key": "DNSPatternStatistic",
*           "count": 1393903
*         },
*         {
*           "id": 3,
*           "key": "IPPatternStatistic",
*           "count": 461301
*         },
*         {
*           "id": 4,
*           "key": "ADPatternStatistic",
*           "count": 106724
*         }
*       ]
*     }
*
* @apiError {String} type Will be set to <code>error</code>.
* @apiError {String} msg  Contains more details about the error itself.
*
* @apiErrorExample Authentication error
*     HTTP/1.1 403 Forbidden
*     {
*       "type": "error",
*       "msg": "no user found for session"
*     }
*
* @apiErrorExample Server error
*     HTTP/1.1 500 Internal Server Error
*     {
*       "type": "error",
*       "msg": "too many connections"
*     }

func UserInfoHandler

func UserInfoHandler(ctx *gin.Context)

*

* @api {get} /users/info/ Information about the current user
* @apiVersion 1.0.0
* @apiName userInfoHandler
* @apiGroup user
* @apiPermission user
*
* @apiExample Usage (curl):
* curl -s http://localhost:8080/users/info/
*
* @apiSuccess {String} type                     Will be set to <code>success</code>.
* @apiSuccess {Object} data                     Contains the user struct.
* @apiSuccess {Number} data.id                  The user identifier.
* @apiSuccess {Date}   data.createdAt           User registration timestamp.
* @apiSuccess {Date}   data.updatedAt           Last updated.
* @apiSuccess {String} data.name                First name.
* @apiSuccess {String} data.surname             Surname.
* @apiSuccess {String} data.bio                 Biography and/or about the user.
* @apiSuccess {String} data.email               Email address of the user.
* @apiSuccess {String} data.nickname            Login or account name.
* @apiSuccess {String} data.serializedPublicKey Serialized public key.
*
* @apiSuccessExample Response
*     HTTP/1.1. 200 OK
*     {
*       "type": "success",
*       "data": {
*         "id": 1,
*         "createdAt": "2020-07-21T15:34:59.626159Z",
*         "updatedAt": "2020-07-21T15:34:59.626159Z",
*         "name": "Lukas",
*         "surname": "Matt",
*         "bio": "It's me :)",
*         "email": "lukas@matt.de",
*         "nickname": "admin",
*         "serializedPublicKey": "-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----\n"
*       }
*     }
*
* @apiError {String} type Will be set to <code>error</code>.
* @apiError {String} msg  Contains more details about the error itself.
*
* @apiErrorExample Authentication error
*     HTTP/1.1 403 Forbidden
*     {
*       "type": "error",
*       "msg": "no user found for session"
*     }
*
* @apiErrorExample Server error
*     HTTP/1.1 500 Internal Server Error
*     {
*       "type": "error",
*       "msg": "too many connections"
*     }

func UserResetPasswordHandler

func UserResetPasswordHandler(ctx *gin.Context)

*

* @api {post} /users/reset_password/ Reset a user account password
* @apiVersion 1.0.0
* @apiName userResetPasswordHandler
* @apiGroup user
* @apiPermission user
*
* @apiParam {String} nickname   A short alphanumeric identifier.
* @apiParam {String} password   The password for the account (min. 4 characters).
* @apiParam {String} repassword Repetition of the password field.
*
* @apiExample Usage (curl):
* curl -s -X POST -d '{"nickname":"admin","password":"s3cr3t","repassword":"s3cr3t"}' http://localhost:8080/users/reset_password/
*
* @apiSuccess {String} type Will be set to <code>success</code>.
*
* @apiSuccessExample Response
*     HTTP/1.1. 200 OK
*     {
*       "type": "success"
*     }
*
* @apiError {String} type Will be set to <code>error</code>.
* @apiError {String} msg  Contains more details about the error itself.
*
* @apiErrorExample Validation error
*     HTTP/1.1 400 Bad Request
*     {
*       "type": "error",
*       "msg": "cannot bind json to struct"
*     }
*
* @apiErrorExample Server error
*     HTTP/1.1 500 Internal Server Error
*     {
*       "type": "error",
*       "msg": "too many connections"
*     }

func UserSignInHandler

func UserSignInHandler(ctx *gin.Context)

*

* @api {post} /users/sign_in/ Login and authenticate cookie based
* @apiVersion 1.0.0
* @apiName userSignInHandler
* @apiGroup user
* @apiPermission user
*
* @apiParam {String}  nickname A short alphanumeric identifier.
* @apiParam {String}  password The password for the account.
* @apiParam {Boolean} [bearer] If set to true, a bearer token instead of a cookie session will be created.
* @apiParam {String}  [note]   If bearer is set to true, a description or note can be specified for the token e.g. "Android device".
*
* @apiExample Usage (curl):
* curl -s -X POST http://localhost:8080/users/sign_in/
*
* @apiSuccess {String} type Will be set to <code>success</code>.
*
* @apiSuccessExample Cookie session
*     HTTP/1.1. 200 OK
*     {
*       "type": "success"
*     }
*
* @apiSuccessExample Bearer token
*     HTTP/1.1. 200 OK
*     {
*       "id": "1",
*       "createdAt": "2020-07-21T15:34:59.626159Z",
*       "userId": "1",
*       "token": "s3cr3tt0k3n",
*       "level": "0"
*     }
*
* @apiError {String} type Will be set to <code>error</code>.
* @apiError {String} msg  Contains more details about the error itself.
*
* @apiErrorExample Validation error
*     HTTP/1.1 400 Bad Request
*     {
*       "type": "error",
*       "msg": "cannot bind json to struct"
*     }
*
* @apiErrorExample Authentication error
*     HTTP/1.1 403 Forbidden
*     {
*       "type": "error",
*       "msg": "no user found for session"
*     }
*
* @apiErrorExample Server error
*     HTTP/1.1 500 Internal Server Error
*     {
*       "type": "error",
*       "msg": "too many connections"
*     }

func UserSignOutHandler

func UserSignOutHandler(ctx *gin.Context)

*

* @api {get} /users/sign_out/ Logout and delete session cookie
* @apiVersion 1.0.0
* @apiName userSignOutHandler
* @apiGroup user
* @apiPermission user
*
* @apiExample Usage (curl):
* curl -s http://localhost:8080/users/sign_out/
*
* @apiSuccess {String} type Will be set to <code>success</code>.
*
* @apiSuccessExample Response
*     HTTP/1.1. 200 OK
*     {
*       "type": "success"
*     }

func UserSignUpHandler

func UserSignUpHandler(ctx *gin.Context)

*

* @api {post} /users/sign_up/ Create a user account
* @apiVersion 1.0.0
* @apiName userSignUpHandler
* @apiGroup user
* @apiPermission user
*
* @apiParam {String} [name]     First name of the user.
* @apiParam {String} [surname]  Surname of the user.
* @apiParam {String} [email]    Email address of the user.
* @apiParam {String} [bio]      About the user and/or a status update.
* @apiParam {String} nickname   A short alphanumeric identifier.
* @apiParam {String} password   The password for the account (min. 4 characters).
* @apiParam {String} repassword Repetition of the password field.
*
* @apiExample Usage (curl):
* curl -s -X POST http://localhost:8080/users/sign_up/
*
* @apiSuccess {String} type Will be set to <code>success</code>.
*
* @apiSuccessExample Response
*     HTTP/1.1. 200 OK
*     {
*       "type": "success"
*     }
*
* @apiError {String} type Will be set to <code>error</code>.
* @apiError {String} msg  Contains more details about the error itself.
*
* @apiErrorExample Validation error
*     HTTP/1.1 400 Bad Request
*     {
*       "type": "error",
*       "msg": "cannot bind json to struct"
*     }
*
* @apiErrorExample Server error
*     HTTP/1.1 500 Internal Server Error
*     {
*       "type": "error",
*       "msg": "too many connections"
*     }

func WifiScanHandler

func WifiScanHandler(ctx *gin.Context)

*

* @api {get} /system/wifi/scan Scan for available wifi networks
* @apiVersion 1.0.0
* @apiName WifiScanHandler
* @apiGroup system
* @apiPermission user
* @apiDescription <div class="alert alert-danger">Please note that the results are being cached for a couple of seconds.</div>
*
* @apiExample Usage (curl):
* curl -s http://localhost:8080/api/v1/system/wifi/scan
*
* @apiSuccess {String} type Will be set to <code>success</code>.
* @apiSuccess {Object[]} data List of available wifi networks
* @apiSuccess {String}   data.ssid The service set ID of the wifi network
* @apiSuccess {Number}   data.dBm The signal strength in dBm
* @apiSuccess {Number}   data.quality The signal strength in percentage
*
* @apiSuccessExample Response
*     HTTP/1.1. 200 OK
*     {
*       "type":"success",
*       "data":[
*         {
*           "ssid":"ZauberNet",
*           "dBm":-72,
*           "quality":56
*         }
*       ]
*     }
*
* @apiError {String} type Will be set to <code>error</code>.
* @apiError {String} msg  Contains more details about the error itself.
*
* @apiErrorExample Authentication error
*     HTTP/1.1 403 Forbidden
*     {
*       "type": "error",
*       "msg": "no user found for session"
*     }
*
* @apiErrorExample Server error
*     HTTP/1.1 500 Internal Server Error
*     {
*       "type": "error",
*       "msg": "too many connections"
*     }

func WorkerInfoHandler

func WorkerInfoHandler(ctx *gin.Context)

*

* @api {get} /system/worker/info Fetch worker status information
* @apiVersion 1.0.0
* @apiName WorkerInfoHandler
* @apiGroup system
* @apiPermission user
*
* @apiExample Usage (curl):
* curl -s http://localhost:8080/api/v1/system/worker/info
*
* @apiSuccess {String}   type Will be set to <code>success</code>.
* @apiSuccess {Object[]} data List of available wifi networks
* @apiSuccess {Number}   data.id Database identifier
* @apiSuccess {Date}     data.createdAt Database creation timestamp
* @apiSuccess {Date}     data.updatedAt Database update timestamp
* @apiSuccess {String}   data.workerName The worker name in string format
* @apiSuccess {Boolean}  data.alive If the worker is currently running
* @apiSuccess {Number}   data.retries How often the worker restarted
* @apiSuccess {String}   data.error Error message if the worker failed or encountered a problem
*
* @apiSuccessExample Response
*     HTTP/1.1. 200 OK
*     {
*       "type":"success",
*       "data":[
*         {
*           "id":8,
*           "createdAt":"2021-01-28T15:42:10.765771Z",
*           "updatedAt":"2021-01-28T16:03:00.079666Z",
*           "workerName":"Frontend",
*           "alive":true,
*           "retries":0,
*           "error":""
*         }
*       ]
*     }
*
* @apiError {String} type Will be set to <code>error</code>.
* @apiError {String} msg  Contains more details about the error itself.
*
* @apiErrorExample Authentication error
*     HTTP/1.1 403 Forbidden
*     {
*       "type": "error",
*       "msg": "no user found for session"
*     }
*
* @apiErrorExample Server error
*     HTTP/1.1 500 Internal Server Error
*     {
*       "type": "error",
*       "msg": "too many connections"
*     }

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL