server

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BodyAllowedForStatus added in v0.1.0

func BodyAllowedForStatus(status int) bool

func BoxToHttpFileSystem

func BoxToHttpFileSystem(box goxr.Box) http.FileSystem

func InitiatorBaseConfigureCli added in v0.2.0

func InitiatorBaseConfigureCli(instance *Initiator) error

func InitiatorConfigureCliAction added in v0.2.0

func InitiatorConfigureCliAction(instance *Initiator) error

func InitiatorPhaseFixLogLevelFlag added in v0.2.0

func InitiatorPhaseFixLogLevelFlag(instance *Initiator) error

func InitiatorPrepare added in v0.2.0

func InitiatorPrepare(instance *Initiator) error

func ReportNotHandableProblem added in v0.1.0

func ReportNotHandableProblem(err error, ctx *fasthttp.RequestCtx, logger log.Logger)

Types

type HttpTime

type HttpTime time.Time

func (HttpTime) MarshalText

func (instance HttpTime) MarshalText() (text []byte, err error)

func (*HttpTime) UnmarshalText

func (instance *HttpTime) UnmarshalText(text []byte) error

type Initiator added in v0.2.0

type Initiator struct {
	Server *Server
	App    *cli.App

	Phases []InitiatorPhase
	Fail   func(initiator *Initiator, err error)
}

func NewInitiatorFor added in v0.2.0

func NewInitiatorFor(app *cli.App) *Initiator

func (*Initiator) Execute added in v0.2.0

func (instance *Initiator) Execute()

type InitiatorError added in v0.2.0

type InitiatorError struct {
	Cause    error
	ExitCode int
}

func InitiatorErrorFor added in v0.2.0

func InitiatorErrorFor(err error) InitiatorError

func (InitiatorError) Error added in v0.2.0

func (instance InitiatorError) Error() string

type InitiatorPhase added in v0.2.0

type InitiatorPhase func(initiator *Initiator) error

type Interceptor added in v0.1.0

type Interceptor interface {
	OnBeforeHandle(box goxr.Box, ctx *fasthttp.RequestCtx) (handled bool, newBox goxr.Box, newCtx *fasthttp.RequestCtx)
	OnAfterHandle(box goxr.Box, ctx *fasthttp.RequestCtx)
	OnTargetPathResolved(box goxr.Box, path string, ctx *fasthttp.RequestCtx) (newPath string)
	OnHandleError(box goxr.Box, err error, interceptAllowed bool, ctx *fasthttp.RequestCtx) (handled bool, newErr error, newCtx *fasthttp.RequestCtx)
	OnAccessLog(box goxr.Box, ctx *fasthttp.RequestCtx, event *map[string]interface{}) (handled bool)
	OnWriteHeadersFor(box goxr.Box, ctx *fasthttp.RequestCtx, fi common.FileInfo)
}

type JsonResponse

type JsonResponse struct {
	Path    string   `json:"path,omitempty"`
	Code    int      `json:"code,omitempty"`
	Message string   `json:"message,omitempty"`
	Details string   `json:"details,omitempty"`
	Time    HttpTime `json:"time,omitempty"`
}

func ErrorToHttpResponse

func ErrorToHttpResponse(err error) JsonResponse

func (JsonResponse) Complete

func (instance JsonResponse) Complete(ctx *fasthttp.RequestCtx) JsonResponse

func (JsonResponse) Serve

func (instance JsonResponse) Serve(ctx *fasthttp.RequestCtx, logger log.Logger)

type Server

type Server struct {
	Box           goxr.Box
	Configuration configuration.Configuration

	Logger      log.Logger
	Interceptor Interceptor
}

func (*Server) DoesETagMatched added in v0.1.0

func (instance *Server) DoesETagMatched(box goxr.Box, fi common.FileInfo, ctx *fasthttp.RequestCtx) bool

func (*Server) DoesModifiedMatched added in v0.1.0

func (instance *Server) DoesModifiedMatched(box goxr.Box, fi common.FileInfo, ctx *fasthttp.RequestCtx) bool

func (*Server) Handle added in v0.1.0

func (instance *Server) Handle(ctx *fasthttp.RequestCtx)

func (*Server) HandleError added in v0.1.0

func (instance *Server) HandleError(box goxr.Box, err error, interceptAllowed bool, ctx *fasthttp.RequestCtx)

func (*Server) Log

func (instance *Server) Log() log.Logger

func (*Server) NotModifiedFor added in v0.1.0

func (instance *Server) NotModifiedFor(box goxr.Box, fi common.FileInfo, ctx *fasthttp.RequestCtx)

func (*Server) ResolveInitialTargetPath added in v0.1.0

func (instance *Server) ResolveInitialTargetPath(box goxr.Box, ctx *fasthttp.RequestCtx) string

func (*Server) Run

func (instance *Server) Run() error

func (*Server) ServeFile added in v0.1.0

func (instance *Server) ServeFile(box goxr.Box, path string, ctx *fasthttp.RequestCtx, interceptAllowed bool, statusCode int)

func (*Server) ShouldHandleStatusCode added in v0.1.0

func (instance *Server) ShouldHandleStatusCode(box goxr.Box, code int, ctx *fasthttp.RequestCtx) bool

func (*Server) StatusCodeFor added in v0.1.0

func (instance *Server) StatusCodeFor(err error) int

func (*Server) Validate

func (instance *Server) Validate() error

func (*Server) WriteFileHeadersFor added in v0.1.0

func (instance *Server) WriteFileHeadersFor(fi common.FileInfo, ctx *fasthttp.RequestCtx)

func (*Server) WriteGenericHeaders added in v0.1.0

func (instance *Server) WriteGenericHeaders(ctx *fasthttp.RequestCtx)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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