Versions in this module Expand all Collapse all v0 v0.0.1 Jul 24, 2020 Changes in this version + const CONNECT + const DELETE + const GET + const HEAD + const HeaderAccept + const HeaderAcceptEncoding + const HeaderAccessControlAllowCredentials + const HeaderAccessControlAllowHeaders + const HeaderAccessControlAllowMethods + const HeaderAccessControlAllowOrigin + const HeaderAccessControlExposeHeaders + const HeaderAccessControlMaxAge + const HeaderAccessControlRequestHeaders + const HeaderAccessControlRequestMethod + const HeaderAllow + const HeaderAuthorization + const HeaderContentDisposition + const HeaderContentEncoding + const HeaderContentLength + const HeaderContentSecurityPolicy + const HeaderContentSecurityPolicyReportOnly + const HeaderContentType + const HeaderCookie + const HeaderIfModifiedSince + const HeaderLastModified + const HeaderLocation + const HeaderOrigin + const HeaderReferrerPolicy + const HeaderServer + const HeaderSetCookie + const HeaderStrictTransportSecurity + const HeaderUpgrade + const HeaderVary + const HeaderWWWAuthenticate + const HeaderXCSRFToken + const HeaderXContentTypeOptions + const HeaderXForwardedFor + const HeaderXForwardedProto + const HeaderXForwardedProtocol + const HeaderXForwardedSsl + const HeaderXFrameOptions + const HeaderXHTTPMethodOverride + const HeaderXRealIP + const HeaderXRequestID + const HeaderXRequestedWith + const HeaderXUrlScheme + const HeaderXXSSProtection + const MIMEApplicationForm + const MIMEApplicationJSON + const MIMEApplicationJSONCharsetUTF8 + const MIMEApplicationJavaScript + const MIMEApplicationJavaScriptCharsetUTF8 + const MIMEApplicationMsgpack + const MIMEApplicationProtobuf + const MIMEApplicationXML + const MIMEApplicationXMLCharsetUTF8 + const MIMEMultipartForm + const MIMEOctetStream + const MIMETextHTML + const MIMETextHTMLCharsetUTF8 + const MIMETextPlain + const MIMETextPlainCharsetUTF8 + const MIMETextXML + const MIMETextXMLCharsetUTF8 + const MODE_TYPE_SCF + const MODE_TYPE_WEB + const OPTIONS + const PATCH + const POST + const PROPFIND + const PUT + const REPORT + const TRACE + const URL_PREFIX_ROOT + const Version + var ErrBadGateway = NewHTTPError(http.StatusBadGateway) + var ErrBadRequest = NewHTTPError(http.StatusBadRequest) + var ErrCookieNotFound = errors.New("cookie not found") + var ErrForbidden = NewHTTPError(http.StatusForbidden) + var ErrInternalServerError = NewHTTPError(http.StatusInternalServerError) + var ErrInvalidCertOrKeyType = errors.New("invalid cert or key type, must be string or []byte") + var ErrInvalidRedirectCode = errors.New("invalid redirect status code") + var ErrMethodNotAllowed = NewHTTPError(http.StatusMethodNotAllowed) + var ErrNotFound = NewHTTPError(http.StatusNotFound) + var ErrRendererNotRegistered = errors.New("renderer not registered") + var ErrRequestTimeout = NewHTTPError(http.StatusRequestTimeout) + var ErrServiceUnavailable = NewHTTPError(http.StatusServiceUnavailable) + var ErrStatusRequestEntityTooLarge = NewHTTPError(http.StatusRequestEntityTooLarge) + var ErrTooManyRequests = NewHTTPError(http.StatusTooManyRequests) + var ErrUnauthorized = NewHTTPError(http.StatusUnauthorized) + var ErrUnsupportedMediaType = NewHTTPError(http.StatusUnsupportedMediaType) + var ErrValidatorNotRegistered = errors.New("validator not registered") + var MethodNotAllowedHandler = func(c Context) error + var NotFoundHandler = func(c Context) error + func GetPath(r *http.Request) string + type Application struct + AutoTLSManager autocert.Manager + Binder Binder + Config *resource.GzconfigStruct + Debug bool + DisableHTTP2 bool + HTTPErrorHandler HTTPErrorHandler + HideBanner bool + HidePort bool + IPExtractor IPExtractor + Listener net.Listener + Logger Logger + Renderer Renderer + Server *http.Server + StdLogger *stdLog.Logger + TLSListener net.Listener + TLSServer *http.Server + Validator Validator + func Initialize(config *resource.GzconfigStruct) (app *Application) + func (app *Application) AcquireContext() Context + func (app *Application) Add(method, path string, handler HandlerFunc, middleware ...MiddlewareFunc) *Route + func (app *Application) AddMiddleware(key string, middleware MiddlewareFunc) + func (app *Application) Any(path string, handler HandlerFunc, middleware ...MiddlewareFunc) []*Route + func (app *Application) CONNECT(path string, h HandlerFunc, m ...MiddlewareFunc) *Route + func (app *Application) Close() error + func (app *Application) DELETE(path string, h HandlerFunc, m ...MiddlewareFunc) *Route + func (app *Application) DefaultHTTPErrorHandler(err error, c Context) + func (app *Application) File(path, file string, m ...MiddlewareFunc) *Route + func (app *Application) GET(path string, h HandlerFunc, m ...MiddlewareFunc) *Route + func (app *Application) Group(prefix string, m ...MiddlewareFunc) (g *Group) + func (app *Application) HEAD(path string, h HandlerFunc, m ...MiddlewareFunc) *Route + func (app *Application) Host(name string, m ...MiddlewareFunc) (g *Group) + func (app *Application) Match(methods []string, path string, handler HandlerFunc, ...) []*Route + func (app *Application) NewContext(r *http.Request, w http.ResponseWriter) Context + func (app *Application) OPTIONS(path string, h HandlerFunc, m ...MiddlewareFunc) *Route + func (app *Application) PATCH(path string, h HandlerFunc, m ...MiddlewareFunc) *Route + func (app *Application) POST(path string, h HandlerFunc, m ...MiddlewareFunc) *Route + func (app *Application) PUT(path string, h HandlerFunc, m ...MiddlewareFunc) *Route + func (app *Application) ReleaseContext(c Context) + func (app *Application) Remove(key string) + func (app *Application) Reverse(name string, params ...interface{}) string + func (app *Application) Routes() []*Route + func (app *Application) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (app *Application) Shutdown(ctx stdContext.Context) error + func (app *Application) Start(address string) error + func (app *Application) StartAutoTLS(address string) error + func (app *Application) StartH2CServer(address string, h2s *http2.Server) (err error) + func (app *Application) StartServer(s *http.Server) (err error) + func (app *Application) StartTLS(address string, certFile, keyFile interface{}) (err error) + func (app *Application) Static(prefix, root string) *Route + func (app *Application) TRACE(path string, h HandlerFunc, m ...MiddlewareFunc) *Route + func (app *Application) URI(handler HandlerFunc, params ...interface{}) string + func (app *Application) URL(h HandlerFunc, params ...interface{}) string + func (app *Application) Use(middleware ...MiddlewareFunc) + func (e *Application) Pre(middleware ...MiddlewareFunc) + func (e *Application) Router() *Router + func (e *Application) Routers() map[string]*Router + type BindUnmarshaler interface + UnmarshalParam func(param string) error + type Binder interface + Bind func(i interface{}, c Context) error + type Context interface + Application func() *Application + Attachment func(file string, name string) error + Bind func(i interface{}) error + Blob func(code int, contentType string, b []byte) error + Cookie func(name string) (*http.Cookie, error) + Cookies func() []*http.Cookie + Error func(err error) + File func(file string) error + FormFile func(name string) (*multipart.FileHeader, error) + FormParams func() (url.Values, error) + FormValue func(name string) string + Get func(key string) interface{} + HTML func(code int, html string) error + HTMLBlob func(code int, b []byte) error + Handler func() HandlerFunc + Inline func(file string, name string) error + IsTLS func() bool + IsWebSocket func() bool + JSON func(code int, i interface{}) error + JSONBlob func(code int, b []byte) error + JSONP func(code int, callback string, i interface{}) error + JSONPBlob func(code int, callback string, b []byte) error + JSONPretty func(code int, i interface{}, indent string) error + Logger func() Logger + MultipartForm func() (*multipart.Form, error) + NoContent func(code int) error + Param func(name string) string + ParamNames func() []string + ParamValues func() []string + Path func() string + QueryParam func(name string) string + QueryParams func() url.Values + QueryString func() string + RealIP func() string + Redirect func(code int, url string) error + Render func(code int, name string, data interface{}) error + Request func() *http.Request + Reset func(r *http.Request, w http.ResponseWriter) + Response func() *Response + Scheme func() string + Set func(key string, val interface{}) + SetCookie func(cookie *http.Cookie) + SetHandler func(h HandlerFunc) + SetLogger func(l Logger) + SetParamNames func(names ...string) + SetParamValues func(values ...string) + SetPath func(p string) + SetRequest func(r *http.Request) + SetResponse func(r *Response) + Stream func(code int, contentType string, r io.Reader) error + String func(code int, s string) error + Validate func(i interface{}) error + XML func(code int, i interface{}) error + XMLBlob func(code int, b []byte) error + XMLPretty func(code int, i interface{}, indent string) error + type DefaultBinder struct + func (b *DefaultBinder) Bind(i interface{}, c Context) (err error) + type Group struct + func (g *Group) Add(method, path string, handler HandlerFunc, middleware ...MiddlewareFunc) *Route + func (g *Group) AddMiddleware(key string, middleware MiddlewareFunc) + func (g *Group) Any(path string, handler HandlerFunc, middleware ...MiddlewareFunc) []*Route + func (g *Group) CONNECT(path string, h HandlerFunc, m ...MiddlewareFunc) *Route + func (g *Group) DELETE(path string, h HandlerFunc, m ...MiddlewareFunc) *Route + func (g *Group) File(path, file string) + func (g *Group) GET(path string, h HandlerFunc, m ...MiddlewareFunc) *Route + func (g *Group) Group(prefix string, middleware ...MiddlewareFunc) (sg *Group) + func (g *Group) HEAD(path string, h HandlerFunc, m ...MiddlewareFunc) *Route + func (g *Group) Match(methods []string, path string, handler HandlerFunc, ...) []*Route + func (g *Group) OPTIONS(path string, h HandlerFunc, m ...MiddlewareFunc) *Route + func (g *Group) PATCH(path string, h HandlerFunc, m ...MiddlewareFunc) *Route + func (g *Group) POST(path string, h HandlerFunc, m ...MiddlewareFunc) *Route + func (g *Group) PUT(path string, h HandlerFunc, m ...MiddlewareFunc) *Route + func (g *Group) Remove(key string) + func (g *Group) Static(prefix, root string) + func (g *Group) TRACE(path string, h HandlerFunc, m ...MiddlewareFunc) *Route + func (g *Group) Use(middleware ...MiddlewareFunc) + type GzLambda struct + func New(app *Application) *GzLambda + func (e *GzLambda) Proxy(req events.APIGatewayRequest) (events.APIGatewayResponse, error) + func (e *GzLambda) ProxyWithContext(ctx stdContext.Context, req events.APIGatewayRequest) (events.APIGatewayResponse, error) + type HTTPError struct + Code int + Internal error + Message interface{} + func NewHTTPError(code int, message ...interface{}) *HTTPError + func (he *HTTPError) Error() string + func (he *HTTPError) SetInternal(err error) *HTTPError + func (he *HTTPError) Unwrap() error + type HTTPErrorHandler func(error, Context) + type HandlerFunc func(Context) error + func WrapHandler(h http.Handler) HandlerFunc + type IPExtractor func(*http.Request) string + func ExtractIPDirect() IPExtractor + func ExtractIPFromRealIPHeader(options ...TrustOption) IPExtractor + func ExtractIPFromXFFHeader(options ...TrustOption) IPExtractor + type Logger interface + Debug func(i ...interface{}) + Debugf func(format string, args ...interface{}) + Debugj func(j log.JSON) + Error func(i ...interface{}) + Errorf func(format string, args ...interface{}) + Errorj func(j log.JSON) + Fatal func(i ...interface{}) + Fatalf func(format string, args ...interface{}) + Fatalj func(j log.JSON) + Info func(i ...interface{}) + Infof func(format string, args ...interface{}) + Infoj func(j log.JSON) + Level func() log.Lvl + Output func() io.Writer + Panic func(i ...interface{}) + Panicf func(format string, args ...interface{}) + Panicj func(j log.JSON) + Prefix func() string + Print func(i ...interface{}) + Printf func(format string, args ...interface{}) + Printj func(j log.JSON) + SetHeader func(h string) + SetLevel func(v log.Lvl) + SetOutput func(w io.Writer) + SetPrefix func(p string) + Warn func(i ...interface{}) + Warnf func(format string, args ...interface{}) + Warnj func(j log.JSON) + type Map map[string]interface + type MiddlewareFunc func(HandlerFunc) HandlerFunc + func WrapMiddleware(m func(http.Handler) http.Handler) MiddlewareFunc + type Renderer interface + Render func(io.Writer, string, interface{}, Context) error + type Response struct + Committed bool + Size int64 + Status int + Writer http.ResponseWriter + func NewResponse(w http.ResponseWriter, a *Application) (r *Response) + func (r *Response) After(fn func()) + func (r *Response) Before(fn func()) + func (r *Response) Flush() + func (r *Response) Header() http.Header + func (r *Response) Hijack() (net.Conn, *bufio.ReadWriter, error) + func (r *Response) Write(b []byte) (n int, err error) + func (r *Response) WriteHeader(code int) + type Route struct + Method string + Name string + Path string + type Router struct + func NewRouter(a *Application) *Router + func (r *Router) Add(method, path string, h HandlerFunc) + func (r *Router) Find(method, path string, c Context) + type TrustOption func(*ipChecker) + func TrustIPRange(ipRange *net.IPNet) TrustOption + func TrustLinkLocal(v bool) TrustOption + func TrustLoopback(v bool) TrustOption + func TrustPrivateNet(v bool) TrustOption + type Validator interface + Validate func(i interface{}) error