Documentation
¶
Index ¶
- Constants
- type IAPIRoute
- type IAPIRouter
- type IAPIWebsocketRoute
- type IApplication
- type ICORSBuilder
- type ICORSConfigurer
- type ICSRFBuilder
- type IContainerBuilder
- type ICsrfConfig
- type IDigContainer
- type IHTTPSRedirectBuilder
- type IInclude
- type IIncludeBuilder
- type IJWTBuilder
- type IJWTConfig
- type IJwt
- type ILogger
- type IMiddleware
- type IRateLimiter
- type IRateLimiterBuilder
- type IRateRecord
- type IRequestScope
- type ISanitizationBuilder
- type IStaticFile
- type IssueType
- type Location
- type MediaType
- type Middleware
- type TagType
- type UploadFile
Constants ¶
View Source
const ( ParamLocationPath = "path" ParamLocationQuery = "query" ParamLocationHeader = "header" ParamLocationCookie = "cookie" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IAPIRoute ¶
type IAPIRoute interface {
Wrap(middlewares ...Middleware)
}
type IAPIRouter ¶
type IAPIRouter interface { WEBSOCKET(path string, handler interface{}, origin func(r *http.Request) bool) IAPIRoute GET(path string, handler interface{}) IAPIRoute POST(path string, handler interface{}) IAPIRoute PUT(path string, handler interface{}) IAPIRoute PATCH(path string, handler interface{}) IAPIRoute DELETE(path string, handler interface{}) IAPIRoute OPTIONS(path string, handler interface{}) IAPIRoute Secure(secure bool) AddRoute(path string, handler interface{}, methods ...string) IAPIRoute AddWebsocketRoute(path string, handler interface{}, origin func(r *http.Request) bool, methods ...string) IAPIRoute Wrap(middlewares ...Middleware) Prefix(prefix string) Version(version string) }
type IAPIWebsocketRoute ¶
type IAPIWebsocketRoute interface {
Wrap(middlewares ...Middleware)
}
type IApplication ¶
type IApplication interface { ILogger IInclude IJwt IMiddleware Build(port int) IApplication Mux() http.Handler Di() IContainerBuilder // Agregamos los builders Include() IIncludeBuilder CSRF() ICSRFBuilder JWTBearer() IJWTBuilder RateLimiter() IRateLimiterBuilder Sanitization() ISanitizationBuilder Cors() ICORSBuilder HTTPSRedirect() IHTTPSRedirectBuilder }
type ICORSBuilder ¶
type ICORSBuilder interface { Origins(origins ...string) ICORSBuilder Methods(methods ...string) ICORSBuilder Headers(headers ...string) ICORSBuilder Credentials(allow bool) ICORSBuilder Apply() IApplication }
type ICORSConfigurer ¶
type ICSRFBuilder ¶
type ICSRFBuilder interface { SecretKey(key string) ICSRFBuilder TokenLookup(lookup string) ICSRFBuilder CookiePath(path string) ICSRFBuilder CookieName(name string) ICSRFBuilder CookieDomain(domain string) ICSRFBuilder CookieSecure(secure bool) ICSRFBuilder CookieHTTPOnly(httpOnly bool) ICSRFBuilder CookieSameSite(sameSite csrf.SameSiteMode) ICSRFBuilder Apply() IApplication }
type IContainerBuilder ¶
type IContainerBuilder interface { // Métodos de Container Provide(instance interface{}) IContainerBuilder Apply() IApplication }
type ICsrfConfig ¶
type ICsrfConfig interface { SecretKey() []byte SetSecretKey([]byte) TokenLookup() string SetTokenLookup(string) CookiePath() string SetCookiePath(string) CookieName() string SetCookieName(string) CookieDomain() string SetCookieDomain(string) CookieSecure() bool SetCookieSecure(bool) CookieHTTPOnly() bool SetCookieHTTPOnly(bool) CookieSameSite() csrf.SameSiteMode SetCookieSameSite(csrf.SameSiteMode) }
type IDigContainer ¶
type IDigContainer interface { Provide(constructor interface{}, opts ...dig.ProvideOption) error Invoke(function interface{}, opts ...dig.InvokeOption) error }
type IHTTPSRedirectBuilder ¶
type IHTTPSRedirectBuilder interface {
Apply() IApplication
}
type IInclude ¶
type IInclude interface {
AddRouter(rtrg func(IAPIRouter))
}
type IIncludeBuilder ¶
type IIncludeBuilder interface { Add(rtrg func(IAPIRouter)) IIncludeBuilder Apply() IApplication }
type IJWTBuilder ¶
type IJWTBuilder interface { Key(key string) IJWTBuilder Algorithms(algorithms []string) IJWTBuilder Audience(audience []string) IJWTBuilder Issue(issuer []string) IJWTBuilder Apply() IApplication }
type IJWTConfig ¶
type IJwt ¶
type IJwt interface {
SetJwtConfig(IJWTConfig)
}
type IMiddleware ¶
type IMiddleware interface {
AddMiddleware(Middleware)
}
type IRateLimiter ¶
type IRateLimiterBuilder ¶
type IRateLimiterBuilder interface { ReqLimit(maxRequests int) IRateLimiterBuilder Duration(window time.Duration) IRateLimiterBuilder Apply() IApplication }
type IRateRecord ¶
type IRequestScope ¶
type IRequestScope interface { Request() *http.Request Response() http.ResponseWriter Protocol() string Location() *url.URL Pathway() string ClientIP() string Referral() string QueryVal(key string) (string, bool) UriParam(key string) (string, bool) MetaVal(key string) (string, bool) CrumbVal(name string) (*http.Cookie, bool) Respond(status int, v interface{}) Throw(status int, err interface{}) SetStatus(status int) MediaType(mt MediaType) SetHeader(key, value string) SetCrumb(cookie *http.Cookie) SetBaggage(key string, value any) SecureChannel() *tls.ConnectionState Hostname() string RedirectTo(code int, url string) }
type ISanitizationBuilder ¶
type ISanitizationBuilder interface {
Apply() IApplication
}
type IStaticFile ¶
type IssueType ¶
type IssueType string
const ( Missing IssueType = "missing" // Falta un campo Invalid IssueType = "invalid" // Valor no válido TypeError IssueType = "type_error" // Error de tipo Unsupported IssueType = "unsupported" // No soportado Empty IssueType = "empty" // Campo vacío Multipart IssueType = "multipart" // Error en multipart URLEncoded IssueType = "urlencoded" // Error en urlencoded Syntax IssueType = "syntax" // Error de sintaxis JSONType IssueType = "json_type" // Error en tipo JSON Target IssueType = "target" // Error en objetivo General IssueType = "general" // Error genérico BodyRead IssueType = "body_read" // Error al leer el cuerpo InvalidType IssueType = "invalid_type" // Tipo no válido UnsupportedType IssueType = "unsupported_type" // Tipo no soportado )
type MediaType ¶
type MediaType string
const ( ApplicationProblemJSON = "application/problem+json" ApplicationJSON MediaType = "application/json" TextPlain MediaType = "text/plain" TextHTML MediaType = "text/html" ApplicationXML MediaType = "application/xml" OctetStream MediaType = "application/octet-stream" ApplicationForm MediaType = "application/x-www-form-urlencoded" MultipartForm MediaType = "multipart/form-data" )
type Middleware ¶
type Middleware func(scope IRequestScope, handler func())
type UploadFile ¶
type UploadFile *multipart.FileHeader
Click to show internal directories.
Click to hide internal directories.