Documentation
¶
Index ¶
- type APIFWModeAPI
- func (a *APIFWModeAPI) GetPrometheusCollectors() ([]prometheus.Collector, error)
- func (a *APIFWModeAPI) UpdateSpecsStorage() ([]int, bool, error)
- func (a *APIFWModeAPI) ValidateRequest(schemaIDs []int, uri, method, body []byte, headers map[string][]string) (*validator.ValidationResponse, error)
- func (a *APIFWModeAPI) ValidateRequestFromReader(schemaIDs []int, r *bufio.Reader) (*validator.ValidationResponse, error)
- type APIFirewall
- type Configuration
- type Option
- type RequestValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIFWModeAPI ¶
type APIFWModeAPI struct {
// contains filtered or unexported fields
}
func (*APIFWModeAPI) GetPrometheusCollectors ¶ added in v0.9.2
func (a *APIFWModeAPI) GetPrometheusCollectors() ([]prometheus.Collector, error)
GetPrometheusCollectors returns Prometheus collectors for external registration and monitoring
func (*APIFWModeAPI) UpdateSpecsStorage ¶
func (a *APIFWModeAPI) UpdateSpecsStorage() ([]int, bool, error)
UpdateSpecsStorage method reloads data from SQLite DB with specs
func (*APIFWModeAPI) ValidateRequest ¶
func (a *APIFWModeAPI) ValidateRequest(schemaIDs []int, uri, method, body []byte, headers map[string][]string) (*validator.ValidationResponse, error)
ValidateRequest method validates request against the spec with provided schema ID
func (*APIFWModeAPI) ValidateRequestFromReader ¶
func (a *APIFWModeAPI) ValidateRequestFromReader(schemaIDs []int, r *bufio.Reader) (*validator.ValidationResponse, error)
ValidateRequestFromReader method validates request against the spec with provided schema ID
type APIFirewall ¶
type APIFirewall interface { ValidateRequestFromReader(schemaIDs []int, r *bufio.Reader) (*validator.ValidationResponse, error) ValidateRequest(schemaIDs []int, uri, method, body []byte, headers map[string][]string) (*validator.ValidationResponse, error) UpdateSpecsStorage() ([]int, bool, error) GetPrometheusCollectors() ([]prometheus.Collector, error) }
func NewAPIFirewall ¶
func NewAPIFirewall(options ...Option) (APIFirewall, error)
type Configuration ¶
type Option ¶
type Option func(*Configuration)
func DisablePassOptionsRequests ¶
func DisablePassOptionsRequests() Option
DisablePassOptionsRequests is a functional option to disable requests with method OPTIONS
func DisableUnknownParameters ¶
func DisableUnknownParameters() Option
DisableUnknownParameters is a functional option to disable following redirects.
func EnablePassOptionsRequests ¶ added in v0.9.2
func EnablePassOptionsRequests() Option
EnablePassOptionsRequests is a functional option to enable requests with method OPTIONS
func EnablePrometheusMetrics ¶ added in v0.9.2
func EnablePrometheusMetrics() Option
EnablePrometheusMetrics is a functional option to enable prometheus metrics
func WithDBVersion ¶
WithDBVersion is a functional option to set the SQLLite DB structure version
func WithMaxErrorsInResponse ¶ added in v0.9.1
WithMaxErrorsInResponse is a functional option to set max errors in the response
func WithPathToDB ¶
WithPathToDB is a functional option to set path to the SQLLite DB with the OpenAPI specifications
type RequestValidator ¶
type RequestValidator struct { CustomRoute *loader.CustomRoute OpenAPIRouter *loader.Router ParserPool *fastjson.ParserPool Metrics metrics.Metrics SchemaID int Options *Configuration }
func (*RequestValidator) APIModeHandler ¶
func (rv *RequestValidator) APIModeHandler(ctx *fasthttp.RequestCtx) (err error)
APIModeHandler finds route in the OpenAPI spec and validates request