httpserver

package
v0.0.0-...-2768190 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: AGPL-3.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorHandler

func ErrorHandler(next echo.HandlerFunc) echo.HandlerFunc

func RequestLogger

func RequestLogger(next echo.HandlerFunc) echo.HandlerFunc

inspired from https://github.com/ziflex/lecho/blob/3cf18943c98abe517c9ac68740579093481588cc/middleware.go

func RequestRecover

func RequestRecover(next echo.HandlerFunc) echo.HandlerFunc

inspired from https://github.com/labstack/echo/blob/3b07058a1d8f440497dc7be1d2ad9a2767c84a57/middleware/recover.go

func RequestTimeout

func RequestTimeout(timeout time.Duration) echo.MiddlewareFunc

Types

type AppTemplate

type AppTemplate string
const (
	TemplateOffline        AppTemplate = "_offline"
	TemplateAbout          AppTemplate = "about"
	TemplateCreateSecret   AppTemplate = "create-secret"
	TemplateGetSecret      AppTemplate = "get-secret"
	TemplateError          AppTemplate = "error"
	TemplateViewSecret     AppTemplate = "view-secret"
	TemplateViewSecretLink AppTemplate = "view-secret-link"
)

type HTTPServer

type HTTPServer struct {
	PublicURL string
	Store     common.Store
	// contains filtered or unexported fields
}

func New

func New(config HTTPServerConfig, publicURL string, store common.Store) *HTTPServer

func (*HTTPServer) APICreateSecret

func (s *HTTPServer) APICreateSecret(c echo.Context) error

func (*HTTPServer) APIGetSecret

func (s *HTTPServer) APIGetSecret(c echo.Context) error

func (*HTTPServer) APIInfos

func (s *HTTPServer) APIInfos(c echo.Context) error

func (*HTTPServer) CreateSecret

func (s *HTTPServer) CreateSecret(c echo.Context) error

func (*HTTPServer) DisplayAboutPage

func (s *HTTPServer) DisplayAboutPage(c echo.Context) error

func (*HTTPServer) DisplayHomePage

func (s *HTTPServer) DisplayHomePage(c echo.Context) error

func (*HTTPServer) DisplayOfflinePage

func (s *HTTPServer) DisplayOfflinePage(c echo.Context) error

func (*HTTPServer) GetSecret

func (s *HTTPServer) GetSecret(c echo.Context) error

func (*HTTPServer) GetSecretContent

func (s *HTTPServer) GetSecretContent(c echo.Context) error

func (*HTTPServer) Shutdown

func (s *HTTPServer) Shutdown() error

func (*HTTPServer) Start

func (s *HTTPServer) Start() (returnErr error)

func (*HTTPServer) TestCreateSecret

func (s *HTTPServer) TestCreateSecret(c echo.Context) error

func (*HTTPServer) TestGetSecret

func (s *HTTPServer) TestGetSecret(c echo.Context) error

func (*HTTPServer) TestSecret

func (s *HTTPServer) TestSecret(c echo.Context) error

type HTTPServerConfig

type HTTPServerConfig struct {
	Host                 string        `default:"0.0.0.0"`
	Port                 uint64        `default:"5000"`
	Timeout              time.Duration `default:"5s"`
	ReadHeaderTimeout    time.Duration `default:"15s"` // the amount of time allowed to read request headers
	ReadTimeout          time.Duration `default:"30s"` // the maximum duration for reading the entire request, including the body
	WriteTimeout         time.Duration `default:"5m"`  // the maximum duration before timing out writes of the response
	IdleTimeout          time.Duration `default:"30s"` // the maximum amount of time to wait for the next request when keep-alives are enabled.
	RequestTimeout       time.Duration `default:"3s"`
	ShutdownTimeout      time.Duration `default:"15s"`
	GzipCompressionLevel int           `default:"5"`
	DebugTemplates       bool          `default:"false"`
}

type TemplatesRenderer

type TemplatesRenderer struct {
	// contains filtered or unexported fields
}

func (*TemplatesRenderer) Render

func (t *TemplatesRenderer) Render(w io.Writer, name string, data interface{}, c echo.Context) error

Jump to

Keyboard shortcuts

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