Documentation
¶
Index ¶
- Variables
- func DisableMultiStringFormat(i interface{}) string
- func LoadModSecurityConfiguration(cfg *ModSecurity, logger zerolog.Logger) (coraza.WAF, error)
- func ValidateStatusList(fl validator.FieldLevel) bool
- type APIFWInit
- type APIFWServer
- type APIMode
- type AllowIP
- type AllowIPlist
- type Backend
- type CustomHeader
- type DNS
- type Denylist
- type Endpoint
- type EndpointList
- type GraphQL
- type GraphQLMode
- type HTTPStatusCodeList
- type Introspection
- type JWT
- type ModSecurity
- type Nameserver
- type Oauth
- type ProtectedAPI
- type ProxyMode
- type ShadowAPI
- type TLS
- type Token
- type ValidationMode
- type ZerologAdapter
Constants ¶
This section is empty.
Variables ¶
View Source
var ( AllHttpStatuses = []int{ http.StatusContinue, http.StatusSwitchingProtocols, http.StatusProcessing, http.StatusEarlyHints, http.StatusOK, http.StatusCreated, http.StatusAccepted, http.StatusNonAuthoritativeInfo, http.StatusNoContent, http.StatusResetContent, http.StatusPartialContent, http.StatusMultiStatus, http.StatusAlreadyReported, http.StatusIMUsed, http.StatusMultipleChoices, http.StatusMovedPermanently, http.StatusFound, http.StatusSeeOther, http.StatusNotModified, http.StatusUseProxy, http.StatusTemporaryRedirect, http.StatusPermanentRedirect, http.StatusBadRequest, http.StatusUnauthorized, http.StatusPaymentRequired, http.StatusForbidden, http.StatusNotFound, http.StatusMethodNotAllowed, http.StatusNotAcceptable, http.StatusProxyAuthRequired, http.StatusRequestTimeout, http.StatusConflict, http.StatusGone, http.StatusLengthRequired, http.StatusPreconditionFailed, http.StatusRequestEntityTooLarge, http.StatusRequestURITooLong, http.StatusUnsupportedMediaType, http.StatusRequestedRangeNotSatisfiable, http.StatusExpectationFailed, http.StatusTeapot, http.StatusMisdirectedRequest, http.StatusUnprocessableEntity, http.StatusLocked, http.StatusFailedDependency, http.StatusTooEarly, http.StatusUpgradeRequired, http.StatusPreconditionRequired, http.StatusTooManyRequests, http.StatusRequestHeaderFieldsTooLarge, http.StatusUnavailableForLegalReasons, http.StatusInternalServerError, http.StatusNotImplemented, http.StatusBadGateway, http.StatusServiceUnavailable, http.StatusGatewayTimeout, http.StatusHTTPVersionNotSupported, http.StatusVariantAlsoNegotiates, http.StatusInsufficientStorage, http.StatusLoopDetected, http.StatusNotExtended, http.StatusNetworkAuthenticationRequired, } )
Functions ¶
func DisableMultiStringFormat ¶ added in v0.9.0
func DisableMultiStringFormat(i interface{}) string
func LoadModSecurityConfiguration ¶ added in v0.7.0
func LoadModSecurityConfiguration(cfg *ModSecurity, logger zerolog.Logger) (coraza.WAF, error)
func ValidateStatusList ¶
func ValidateStatusList(fl validator.FieldLevel) bool
Types ¶
type APIFWServer ¶ added in v0.8.3
type APIFWServer struct { APIHost string `conf:"default:http://0.0.0.0:8282,env:URL" validate:"required,url"` HealthAPIHost string `conf:"default:0.0.0.0:9667,env:HEALTH_HOST" validate:"required"` ReadTimeout time.Duration `conf:"default:5s"` WriteTimeout time.Duration `conf:"default:5s"` ReadBufferSize int `conf:"default:8192"` WriteBufferSize int `conf:"default:8192"` MaxRequestBodySize int `conf:"default:4194304"` DisableKeepalive bool `conf:"default:false"` MaxConnsPerIP int `conf:"default:0"` MaxRequestsPerConn int `conf:"default:0"` }
type APIMode ¶ added in v0.6.13
type APIMode struct { APIFWInit APIFWServer ModSecurity AllowIP AllowIP TLS TLS SpecificationUpdatePeriod time.Duration `conf:"default:1m,env:API_MODE_SPECIFICATION_UPDATE_PERIOD"` PathToSpecDB string `conf:"env:API_MODE_DEBUG_PATH_DB"` DBVersion int `conf:"default:0,env:API_MODE_DB_VERSION"` UnknownParametersDetection bool `conf:"default:true,env:API_MODE_UNKNOWN_PARAMETERS_DETECTION"` PassOptionsRequests bool `conf:"default:false,env:PASS_OPTIONS"` }
type AllowIPlist ¶ added in v0.6.16
type AllowIPlist struct {
AllowedIP AllowIP
}
type Backend ¶ added in v0.6.13
type Backend struct { ProtectedAPI Oauth Oauth }
type CustomHeader ¶ added in v0.7.4
type Endpoint ¶ added in v0.9.0
type Endpoint struct { ValidationMode `mapstructure:",squash"` Path string `conf:"required" validate:"url"` Method string `conf:"" validate:"required"` }
type EndpointList ¶ added in v0.9.0
type EndpointList []Endpoint
func (*EndpointList) Set ¶ added in v0.9.0
func (e *EndpointList) Set(value string) error
Set method parses list of Endpoints string to the list of Endpoint objects
func (EndpointList) String ¶ added in v0.9.0
func (e EndpointList) String() string
String method returns a string representation of the Endpoint objects list
type GraphQL ¶ added in v0.6.13
type GraphQL struct { MaxQueryComplexity int `conf:"required" validate:"required"` MaxQueryDepth int `conf:"required" validate:"required"` MaxAliasesNum int `conf:"required" validate:"required"` NodeCountLimit int `conf:"required" validate:"required"` BatchQueryLimit int `conf:"required" validate:"required"` DisableFieldDuplication bool `conf:"default:false"` Playground bool `conf:"default:false"` PlaygroundPath string `conf:"default:/" validate:"path"` Introspection bool `conf:"required" validate:"required"` Schema string `conf:"required" validate:"required"` WSCheckOrigin bool `conf:"default:false"` WSOrigin []string `conf:"" validate:"url"` RequestValidation string `conf:"required" validate:"required,oneof=DISABLE BLOCK LOG_ONLY"` }
type GraphQLMode ¶ added in v0.6.13
type GraphQLMode struct { APIFWInit APIFWServer Graphql GraphQL TLS TLS Server ProtectedAPI Denylist Denylist AllowIP AllowIP }
type HTTPStatusCodeList ¶
type HTTPStatusCodeList struct {
StatusCodes []int
}
type Introspection ¶
type ModSecurity ¶ added in v0.7.0
type Nameserver ¶ added in v0.8.0
type Oauth ¶
type Oauth struct { ValidationType string `conf:"default:JWT"` JWT JWT Introspection Introspection }
type ProtectedAPI ¶ added in v0.8.3
type ProtectedAPI struct { URL string `conf:"default:http://localhost:3000/v1/" validate:"required,url"` RequestHostHeader string `conf:""` ClientPoolCapacity int `conf:"default:1000" validate:"gt=0"` InsecureConnection bool `conf:"default:false"` RootCA string `conf:""` MaxConnsPerHost int `conf:"default:512"` ReadTimeout time.Duration `conf:"default:5s"` WriteTimeout time.Duration `conf:"default:5s"` DialTimeout time.Duration `conf:"default:200ms"` ReadBufferSize int `conf:"default:8192"` WriteBufferSize int `conf:"default:8192"` MaxResponseBodySize int `conf:"default:0"` DeleteAcceptEncoding bool `conf:"default:false"` }
type ProxyMode ¶ added in v0.6.13
type ProxyMode struct { APIFWInit `mapstructure:",squash"` APIFWServer `mapstructure:"Server"` ModSecurity TLS TLS ShadowAPI ShadowAPI Denylist Denylist Server Backend `mapstructure:"Backend"` AllowIP AllowIP DNS DNS Endpoints EndpointList RequestValidation string `conf:"required" validate:"required,oneof=DISABLE BLOCK LOG_ONLY"` ResponseValidation string `conf:"required" validate:"required,oneof=DISABLE BLOCK LOG_ONLY"` CustomBlockStatusCode int `conf:"default:403" validate:"HttpStatusCodes"` AddValidationStatusHeader bool `conf:"default:false"` APISpecs string `conf:"required,env:API_SPECS" validate:"required"` APISpecsCustomHeader CustomHeader `conf:"env:API_SPECS_CUSTOM_HEADER"` PassOptionsRequests bool `conf:"default:false,env:PASS_OPTIONS"` SpecificationUpdatePeriod time.Duration `conf:"default:0"` }
type ValidationMode ¶ added in v0.9.0
type ZerologAdapter ¶ added in v0.9.0
func (*ZerologAdapter) Printf ¶ added in v0.9.0
func (z *ZerologAdapter) Printf(format string, args ...interface{})
Printf func wrapper
Click to show internal directories.
Click to hide internal directories.