http

package
v0.0.0-...-f7ce1ce Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Accepted

func Accepted(ectx echo.Context) error

func BadRequest

func BadRequest(ectx echo.Context, i interface{}) error

func CORSConfig

func CORSConfig() middleware.CORSConfig

func Forbidden

func Forbidden(ectx echo.Context) error

func InternalServerError

func InternalServerError(ectx echo.Context) error

func NoContent

func NoContent(ectx echo.Context) error

func Ok

func Ok(ectx echo.Context, i interface{}) error

func RegisterHandlers

func RegisterHandlers(e *echo.Echo)

func RegisterMiddlewares

func RegisterMiddlewares(e *echo.Echo)

func ReturnInternalServerError

func ReturnInternalServerError(ectx echo.Context) error

func SendToPocketBook

func SendToPocketBook(ectx echo.Context) error

func ServerAddress

func ServerAddress() string

func Start

func Start(e *echo.Echo) error

func TooManyRequests

func TooManyRequests(ectx echo.Context) error

Types

type EndpointThrottlingConfig

type EndpointThrottlingConfig struct {
	Endpoint      string
	Method        string
	MaxRequests   int
	TimePeriodSec int
}

type EndpointThrottlingLimiter

type EndpointThrottlingLimiter struct {
	Limiter  *rate.Limiter
	LastSeen time.Time
	Config   EndpointThrottlingConfig
}

func NewEndpointThrottlingLimiter

func NewEndpointThrottlingLimiter(req http.Request) EndpointThrottlingLimiter

type InvalidRequestFieldResponse

type InvalidRequestFieldResponse struct {
	Field  string `json:"field"`
	Reason string `json:"reason"`
}

func InvalidEmailResponse

func InvalidEmailResponse() InvalidRequestFieldResponse

func NotConnectableUrlResponse

func NotConnectableUrlResponse() InvalidRequestFieldResponse

func UnsupportedDocumentResponse

func UnsupportedDocumentResponse() InvalidRequestFieldResponse

func UnsupportedEmailDomainResponse

func UnsupportedEmailDomainResponse() InvalidRequestFieldResponse

type SendToPocketBookRequest

type SendToPocketBookRequest struct {
	Email string `json:"email"`
	Title string `json:"title"`
	Url   string `json:"url"`
}

type ThrottlingEngine

type ThrottlingEngine struct {
	Visitors      map[string]EndpointThrottlingLimiter
	VisitorsMutex *sync.Mutex
}

func NewThrottlingEngine

func NewThrottlingEngine() ThrottlingEngine

func (*ThrottlingEngine) CanAllowRequest

func (te *ThrottlingEngine) CanAllowRequest(req http.Request, ectx echo.Context) bool

func (*ThrottlingEngine) StartThrottlingEngineCleanUp

func (te *ThrottlingEngine) StartThrottlingEngineCleanUp()

Jump to

Keyboard shortcuts

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