stdserver

package module
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 24 Imported by: 0

README

stdserver

Standard Server

Documentation

Index

Constants

View Source
const JwtContextKey = "jwt"

Variables

This section is empty.

Functions

func ErrBadRequest

func ErrBadRequest(err error, messages ...string) *fiber.Error

func ErrConflict added in v0.4.0

func ErrConflict(err error, message ...string) *fiber.Error

func ErrForbidden

func ErrForbidden(err error, messages ...string) *fiber.Error

func ErrInternalServerError

func ErrInternalServerError(err error, messages ...string) *fiber.Error

func ErrTooManyRequests added in v0.5.5

func ErrTooManyRequests(err error, message ...string) *fiber.Error

func ErrUnauthorized

func ErrUnauthorized(err error, messages ...string) *fiber.Error

func JWT

func JWT(cfg *Settings, claimsType jwt.Claims) fiber.Handler

func MuxSubRouter

func MuxSubRouter(parent fiber.Router, prefix string) *mux.Router

Types

type App

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

func New

func New(settings ...*Settings) *App

func (*App) Context added in v0.2.0

func (app *App) Context() context.Context

func (*App) ContextWithCancel added in v0.2.0

func (app *App) ContextWithCancel() (context.Context, context.CancelFunc)

func (*App) ContextWithDeadline added in v0.2.0

func (app *App) ContextWithDeadline(deadline time.Time) (context.Context, context.CancelFunc)

func (*App) ContextWithTimeout added in v0.2.0

func (app *App) ContextWithTimeout(timeout time.Duration) (context.Context, context.CancelFunc)

func (*App) ContextWithValue added in v0.2.0

func (app *App) ContextWithValue(key interface{}, value interface{}) context.Context

func (*App) Fiber added in v0.3.1

func (app *App) Fiber() *fiber.App

func (*App) Get

func (app *App) Get(path string, handler fiber.Handler) *App

func (*App) IsRunning added in v0.3.1

func (app *App) IsRunning() bool

func (*App) Log

func (app *App) Log(module string, subModule ...string) *zerolog.Logger

func (*App) Post

func (app *App) Post(path string, handler fiber.Handler) *App

func (*App) Router

func (app *App) Router(prefix string, handlers ...fiber.Handler) fiber.Router

func (*App) Start

func (app *App) Start(addr string) error

func (*App) StartChild added in v0.3.1

func (app *App) StartChild(task Task)

func (*App) StartChildDelayed added in v0.3.1

func (app *App) StartChildDelayed(delay time.Duration, task, teardown Task)

func (*App) StartChildInterval added in v0.3.1

func (app *App) StartChildInterval(interval time.Duration, task, teardown Task)

func (*App) StartTLS added in v0.3.0

func (app *App) StartTLS(addr, certFile, keyFile string) error

func (*App) Use

func (app *App) Use(handlers ...fiber.Handler) *App

func (*App) UseHttpHandler

func (app *App) UseHttpHandler(h http.Handler)

func (*App) WrapStart added in v0.3.0

func (app *App) WrapStart(startFunc func() error) error

type Ctx

type Ctx struct {
	fiber.Ctx
}

type KeyEntry

type KeyEntry struct {
	Id  string
	Key interface{}
}

type KeyTable

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

func LoadKeyTableFromDir

func LoadKeyTableFromDir(root string) (*KeyTable, error)

func NewKeyTable

func NewKeyTable() *KeyTable

func (*KeyTable) GetPrivateKeys

func (k *KeyTable) GetPrivateKeys() map[string]interface{}

func (*KeyTable) GetPublicKeys

func (k *KeyTable) GetPublicKeys() map[string]interface{}

func (*KeyTable) PutECKey

func (k *KeyTable) PutECKey(id string, key *ecdsa.PrivateKey)

type LoginFunc

type LoginFunc func(c *fiber.Ctx) (jwt.Claims, error)

type Settings

type Settings struct {
	Fiber        fiber.Config
	Limiter      limiter.Config
	Name         string
	CSRFPath     string
	LoginPath    string
	LoginHandler LoginFunc
	KeyTableDir  string
	Logger       *zerolog.Logger
	Context      context.Context
	SkipAuth     func(ctx *fiber.Ctx) bool
	AllowOrigins string

	// LogLevel sets the default accepted level for logging. It is ignored if Settings.Logger is provided.
	LogLevel zerolog.Level

	ColorfulLogging bool
}

type Task added in v0.3.1

type Task func(ctx context.Context)

Jump to

Keyboard shortcuts

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