utils

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

* Arc - Copyleft of Simone 'evilsocket' Margaritelli. * evilsocket at protonmail dot com * https://www.evilsocket.net/ * * See LICENSE.

* Arc - Copyleft of Simone 'evilsocket' Margaritelli. * evilsocket at protonmail dot com * https://www.evilsocket.net/ * * See LICENSE.

* Arc - Copyleft of Simone 'evilsocket' Margaritelli. * evilsocket at protonmail dot com * https://www.evilsocket.net/ * * See LICENSE.

* Arc - Copyleft of Simone 'evilsocket' Margaritelli. * evilsocket at protonmail dot com * https://www.evilsocket.net/ * * See LICENSE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Api added in v1.3.4

func Api(level log.Verbosity, c *gin.Context, format string, args ...interface{})

func BadRequest

func BadRequest(c *gin.Context, opt_msg ...string)

BadRequest log 400 eror message in JSON format

func Exists

func Exists(path string) bool

Exists returns if a path to a file or directory exist or not

func ExpandPath

func ExpandPath(path string) (string, error)

ExpandPath return Absolute path replace ~ by the path to home directory

func Forbidden

func Forbidden(c *gin.Context, opt_msg ...string)

Forbidden log 403 error message in JSON format

func FormatBytes

func FormatBytes(s uint64) string

func InSlice

func InSlice(a string, list []string) bool

InSlice return if a is in list

func IsFolder

func IsFolder(path string) bool

func NotFound

func NotFound(c *gin.Context, opt_msg ...string)

NotFound log 404 error message in JSON format

func ServerError

func ServerError(c *gin.Context, err error)

ServerError log 500 error message in JSON format

Types

type ErrorResponse

type ErrorResponse struct {
	// The error description.
	// in: body
	// Error code.
	Code int `json:"code"`
	// Error message.
	// in: body
	Message string `json:"message"`
}

ErrorResponse is used when sending a HTTP status response different than 200 swagger:response errorResponse Code reference http://www.restapitutorial.com/httpstatuscodes.html

Jump to

Keyboard shortcuts

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