Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HeaderAuth ¶
HeaderAuth enforces that users are authenticated by reading the Authorization header
func LogRequests ¶
LogRequests logs all requests that pass through with loglevel dependant on status code
Types ¶
type ClamAV ¶
type ClamAV struct {
// contains filtered or unexported fields
}
ClamAV is a virus scanning service backed by a ClamAV tcp connection
type Proxy ¶
type Proxy struct {
AntiVirus VirusScanner
}
Proxy is a http proxy for a VirusScanner
func (*Proxy) Ok ¶
func (p *Proxy) Ok(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
Ok returns a response to a healthz request
func (*Proxy) Scan ¶
func (p *Proxy) Scan(w http.ResponseWriter, r *http.Request, _ httprouter.Params)
Scan performs an scan on the body of the request
type Response ¶
type Response struct { Message string `json:"message,omitempty"` Error string `json:"error,omitempty"` }
Response is a baseline response
type ScanResponse ¶
ScanResponse is a response with the result of a scan
type StatusWriter ¶
type StatusWriter struct { http.ResponseWriter // contains filtered or unexported fields }
StatusWriter wraps a responsewriter to track the status and content length from https://www.reddit.com/r/golang/comments/7p35s4/how_do_i_get_the_response_status_for_my_middleware/
func (*StatusWriter) Write ¶
func (w *StatusWriter) Write(b []byte) (int, error)
Write writes to the changes the underlying ResponseWriter
func (*StatusWriter) WriteHeader ¶
func (w *StatusWriter) WriteHeader(status int)
WriteHeader changes the underlying ResponseWriter header status
type VirusScanner ¶
type VirusScanner interface { Scan(stream io.Reader) (infected bool, msg string, err error) Ok() (ok bool, msg string, err error) }
VirusScanner is the interface for a virus scanning service
func NewClamAV ¶
func NewClamAV(connectionString string) VirusScanner
NewClamAV returns a new ClamAV tcp backed VirusScanner