Documentation ¶
Index ¶
- Constants
- Variables
- func MaxReqSize(maxReqSize int64) func(next http.Handler) http.Handler
- func SetErrorResponse(w http.ResponseWriter, err error)
- type ErrorResponse
- type Handler
- func (h *Handler) InStream(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Ping(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Reload(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Shutdown(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Stats(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Version(w http.ResponseWriter, r *http.Request)
- func (h *Handler) VersionCommands(w http.ResponseWriter, r *http.Request)
- type InStreamResponse
- type PingResponse
- type ReloadResponse
- type ShutdownResponse
- type StatsResponse
- type VersionCommandsResponse
- type VersionResponse
Constants ¶
const (
// ContentTypeApplicationJSON represent the applcation/json Content-Type value
ContentTypeApplicationJSON = "application/json"
)
Variables ¶
var ( ErrFormFile = errors.New("failed to parse file") ErrOpenFileHeaders = errors.New("failed to open multipart file headers") )
var ErrParsingStats = errors.New("error while parsing 'stats'")
Functions ¶
func MaxReqSize ¶ added in v0.2.2
MaxReqSizeis a HTTP middleware limiting the size of the request by using http.MaxBytesReader() on the request body.
func SetErrorResponse ¶
func SetErrorResponse(w http.ResponseWriter, err error)
SetErrorResponse will attempt to parse the given error and set the response status code and using the ResponseWriter according to the type of the error.
Types ¶
type ErrorResponse ¶
ErrorResponse represents the json response for http errors
func NewErrorResponse ¶
func NewErrorResponse(msg string) *ErrorResponse
type Handler ¶
func (*Handler) VersionCommands ¶
func (h *Handler) VersionCommands(w http.ResponseWriter, r *http.Request)
type InStreamResponse ¶
type InStreamResponse struct { Status string `json:"status"` Msg string `json:"msg"` Signature string `json:"signature"` VirusFound bool `json:"virus_found"` }
InStreamResponse represents the json response of a /scan endpoint.
type PingResponse ¶
type PingResponse struct {
Ping string `json:"ping"`
}
PingResponse represents the json response of a /ping endpoint
type ReloadResponse ¶
type ReloadResponse struct {
Status string `json:"status"`
}
ReloadResponse represents the json response of a /reload endpoint.
type ShutdownResponse ¶
type ShutdownResponse struct {
Status string `json:"status"`
}
ShutdownResponse represents the json response of a /shutdown endpoint.
type StatsResponse ¶
type StatsResponse struct { Pools int `json:"pools"` State string `json:"state"` Threads string `json:"threads"` Queue string `json:"queue"` Memstats string `json:"memstats"` }
StatsResponse represents the json response of a /stats endpoint. It represents the statistics about the scan queue, contents of scan queue, and memory usage.
type VersionCommandsResponse ¶
type VersionCommandsResponse struct { Version string `json:"clamav_version"` Commands []string `json:"commands"` }
VersionCommandsResponse represents the json response of a /versioncommands endpoint. It represents the version of Clamav, followed by "| COMMANDS:" and a space-delimited list of supported commands.
type VersionResponse ¶
type VersionResponse struct {
Version string `json:"clamav_version"`
}
VersionResponse represents the json response of a /version endpoint.