Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ReqTooLargeError = echo.NewHTTPError( http.StatusRequestEntityTooLarge, "request is too large")
Functions ¶
func AttachDefenseAgainstDarkArts ¶
Attach middleware to Echo to prevent slow-loris attacks and DDoS-es by extremely large requests.
func LimitReaderWithErr ¶
func LimitReaderWithErr(r io.ReadCloser, n int64, err error) io.ReadCloser
LimitReader returns a Reader that reads from r but stops with an error after n bytes. The underlying implementation is a *LimitedReaderWithErr.
Types ¶
type DirectEchoTransport ¶
type DirectEchoTransport struct {
Echo *echo.Echo
}
type LimitedReaderWithErr ¶
type LimitedReaderWithErr struct { Reader io.ReadCloser // underlying reader BytesLeft int64 // max bytes remaining Error error // the error to return in case of too much data }
A LimitedReaderWithErr reads from Reader but limits the amount of data returned to just BytesLeft bytes. Each call to Read updates BytesLeft to reflect the new amount remaining. Read returns error when BytesLeft <= 0 or when the underlying Reader returns EOF.
func (*LimitedReaderWithErr) Close ¶
func (l *LimitedReaderWithErr) Close() error
Click to show internal directories.
Click to hide internal directories.