http

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HttpServerMaintenanceType = logTypes.NewLogType("HTTP_SERVER_MAINTENANCE")
)

Functions

func GetManager

func GetManager() *manager

GetManager - This function returns singleton instance of Logger Manager

func NewAddGroupToNilServerErr

func NewAddGroupToNilServerErr(name string) error

NewAddGroupToNilServerErr - return a new instance of AddGroupToNilServerErr

func NewAddRouteToNilServerErr

func NewAddRouteToNilServerErr(route string) error

NewAddRouteToNilServerErr - return a new instance of AddRouteToNilServerErr

func NewAttachErrorHandlerToNilServerErr

func NewAttachErrorHandlerToNilServerErr(serverNames ...string) error

NewAttachErrorHandlerToNilServerErr - return a new instance of AttachErrorHandlerToNilServerErr

func NewCreateServerErr

func NewCreateServerErr(err error) error

NewCreateServerErr - return a new instance of CreateServerErr

func NewFromMultipleServerErr

func NewFromMultipleServerErr() error

NewFromMultipleServerErr - return a new instance of FromMultipleServerErr

func NewFromNilServerErr

func NewFromNilServerErr() error

NewFromNilServerErr - return a new instance of FromNilServerErr

func NewGetRouteByNameErr

func NewGetRouteByNameErr(name string) error

NewGetRouteByNameErr - return a new instance of GetRouteByNameErr

func NewGroupRouteNotExistErr

func NewGroupRouteNotExistErr(name string) error

NewGroupRouteNotExistErr - return a new instance of GroupRouteNotExistErr

func NewNotImplementedErr

func NewNotImplementedErr() error

NewNotImplementedErr - return a new instance of NotImplementedErr

func NewNotSupportedHttpMethodErr

func NewNotSupportedHttpMethodErr(method string) error

NewNotSupportedHttpMethodErr - return a new instance of NotSupportedHttpMethodErr

func NewShutdownServerErr

func NewShutdownServerErr(err error) error

NewShutdownServerErr - return a new instance of StartServerErr

func NewStartServerErr

func NewStartServerErr(addr string, err error) error

NewStartServerErr - return a new instance of StartServerErr

func NewUpdateServerConfigErr

func NewUpdateServerConfigErr(err error) error

NewUpdateServerConfigErr - return a new instance of UpdateServerConfigErr

Types

type AddGroupToNilServerErr

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

AddGroupToNilServerErr Error

func (*AddGroupToNilServerErr) Error

func (err *AddGroupToNilServerErr) Error() string

Error method - satisfying error interface

type AddRouteToNilServerErr

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

AddRouteToNilServerErr Error

func (*AddRouteToNilServerErr) Error

func (err *AddRouteToNilServerErr) Error() string

Error method - satisfying error interface

type AttachErrorHandlerToNilServerErr

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

AttachErrorHandlerToNilServerErr Error

func (*AttachErrorHandlerToNilServerErr) Error

Error method - satisfying error interface

type CreateServerErr

type CreateServerErr struct {
	Err error
}

CreateServerErr Error

func (*CreateServerErr) Error

func (err *CreateServerErr) Error() string

Error method - satisfying error interface

type FaviconMiddlewareConfig

type FaviconMiddlewareConfig struct {
	File         string `json:"file"`
	URL          string `json:"url"`
	CacheControl string `json:"cache_control"`
}

type FiberServer

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

Server struct

func NewServer

func NewServer(name string, config types.ServerConfig, rawConfig map[string]interface{}) (*FiberServer, error)

NewServer - create a new instance of Server and return it

func (*FiberServer) AddGroup

func (s *FiberServer) AddGroup(groupName string, f func(c *fiber.Ctx) error, groups ...string) error

AddGroup - add a group to the server

func (*FiberServer) AddRoute

func (s *FiberServer) AddRoute(method string, path string, f func(c *fiber.Ctx) error, routeName string, versions []string, groups []string) error

AddRoute - add a route to the server

func (*FiberServer) AddRouteWithMultiHandlers

func (s *FiberServer) AddRouteWithMultiHandlers(method string, path string, f []func(c *fiber.Ctx) error, routeName string, versions []string, groups []string) error

AddRouteWithMultiHandlers - add a route to the server

func (*FiberServer) AttachErrorHandler

func (s *FiberServer) AttachErrorHandler(f func(ctx *fiber.Ctx, err error) error)

AttachErrorHandler - attach a custom error handler to the server

func (*FiberServer) GetAllRoutes

func (s *FiberServer) GetAllRoutes() []fiber.Route

GetAllRoutes - Get all Routes

func (*FiberServer) GetRouteByName

func (s *FiberServer) GetRouteByName(name string) (*fiber.Route, error)

GetRouteByName _ get route by its name

func (*FiberServer) Start

func (s *FiberServer) Start() error

Start - start the server and listen to provided address

func (*FiberServer) Stop

func (s *FiberServer) Stop() error

Stop - stop the server

func (*FiberServer) UpdateConfigs

func (s *FiberServer) UpdateConfigs(config types.ServerConfig, rawConfig map[string]interface{}) error

type FromMultipleServerErr

type FromMultipleServerErr struct {
}

FromMultipleServerErr Error

func (*FromMultipleServerErr) Error

func (err *FromMultipleServerErr) Error() string

Error method - satisfying error interface

type FromNilServerErr

type FromNilServerErr struct {
}

FromNilServerErr Error

func (*FromNilServerErr) Error

func (err *FromNilServerErr) Error() string

Error method - satisfying error interface

type GetRouteByNameErr

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

GetRouteByNameErr Error

func (*GetRouteByNameErr) Error

func (err *GetRouteByNameErr) Error() string

Error method - satisfying error interface

type GinServer

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

GinServer struct

func NewGinServer

func NewGinServer(name string, config types.GinServerConfig, rawConfig map[string]interface{}) (*GinServer, error)

NewGinServer - create a new instance of Server and return it

func (*GinServer) AddGroup

func (s *GinServer) AddGroup(groupName string, f gin.HandlerFunc, groups ...string) error

func (*GinServer) AddRoute

func (s *GinServer) AddRoute(method string, path string, f func(c *gin.Context), routeName string, versions []string, groups []string) error

func (*GinServer) AddRouteWithMultiHandlers

func (s *GinServer) AddRouteWithMultiHandlers(method string, path string, f []func(c *gin.Context), routeName string, versions []string, groups []string) error

AddRouteWithMultiHandlers - add a route to the server

func (*GinServer) AttachErrorHandler

func (s *GinServer) AttachErrorHandler(f func(ctx *gin.Context, err any))

AttachErrorHandler - attach a custom error handler to the server

func (*GinServer) GetAllRoutes

func (s *GinServer) GetAllRoutes() gin.RoutesInfo

GetAllRoutes - Get all Routes

func (*GinServer) Start

func (s *GinServer) Start() error

Start - start the server and listen to provided address

func (*GinServer) Stop

func (s *GinServer) Stop() error

Stop - stop the server

func (*GinServer) UpdateConfigs

func (s *GinServer) UpdateConfigs(config types.GinServerConfig, rawConfig map[string]interface{}) error

type GroupRouteNotExistErr

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

GroupRouteNotExistErr Error

func (*GroupRouteNotExistErr) Error

func (err *GroupRouteNotExistErr) Error() string

Error method - satisfying error interface

type LoggerMiddlewareConfig

type LoggerMiddlewareConfig struct {
	Format       string `json:"format"`
	TimeFormat   string `json:"time_format"`
	TimeZone     string `json:"time_zone"`
	TimeInterval int    `json:"time_interval"`
	Output       string `json:"output"`
}

LoggerMiddlewareConfig - defines the config for middleware.

type NotImplementedErr

type NotImplementedErr struct {
}

NotImplementedErr Error

func (*NotImplementedErr) Error

func (err *NotImplementedErr) Error() string

Error method - satisfying error interface

type NotSupportedHttpMethodErr

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

NotSupportedHttpMethodErr Error

func (*NotSupportedHttpMethodErr) Error

func (err *NotSupportedHttpMethodErr) Error() string

Error method - satisfying error interface

type ServerConfig

type ServerConfig struct {
	ListenAddress string   `json:"addr"`
	Name          string   `json:"name"`
	Versions      []string `json:"versions"`
	SupportStatic bool     `json:"support_static"`
	Config        struct {
		ServerHeader         string   `json:"server_header"`
		StrictRouting        bool     `json:"strict_routing"`
		CaseSensitive        bool     `json:"case_sensitive"`
		UnescapePath         bool     `json:"unescape_path"`
		Etag                 bool     `json:"etag"`
		BodyLimit            int      `json:"body_limit"`
		Concurrency          int      `json:"concurrency"`
		ReadTimeout          int      `json:"read_timeout"`
		WriteTimeout         int      `json:"write_timeout"`
		IdleTimeout          int      `json:"idle_timeout"`
		ReadBufferSize       int      `json:"read_buffer_size"`
		WriteBufferSize      int      `json:"write_buffer_size"`
		CompressedFileSuffix string   `json:"compressed_file_suffix"`
		GetOnly              bool     `json:"get_only"`
		DisableKeepalive     bool     `json:"disable_keepalive"`
		Network              string   `json:"network"`
		EnablePrintRoutes    bool     `json:"enable_print_routes"`
		AttachErrorHandler   bool     `json:"attach_error_handler"`
		RequestMethods       []string `json:"request_methods"`
	} `json:"conf"`
	Middlewares struct {
		Order []string `json:"order"`
	} `json:"middlewares"`
	Static struct {
		Prefix string       `json:"prefix"`
		Root   string       `json:"root"`
		Config fiber.Static `json:"config"`
	} `json:"static"`
}

type ShutdownServerErr

type ShutdownServerErr struct {
	Err error
}

ShutdownServerErr Error

func (*ShutdownServerErr) Error

func (err *ShutdownServerErr) Error() string

Error method - satisfying error interface

type StartServerErr

type StartServerErr struct {
	Err           error
	ListenAddress string
}

StartServerErr Error

func (*StartServerErr) Error

func (err *StartServerErr) Error() string

Error method - satisfying error interface

type UpdateServerConfigErr

type UpdateServerConfigErr struct {
	Err error
}

UpdateServerConfigErr Error

func (*UpdateServerConfigErr) Error

func (err *UpdateServerConfigErr) Error() string

Error method - satisfying error interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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