Documentation ¶
Index ¶
- func GenerateRandomBytes(len int) ([]byte, error)
- func GenerateRandomStringURLSafe(len int) (string, error)
- type ContentTypeStatus
- type InjectedWriter
- func (i *InjectedWriter) Flush() error
- func (i *InjectedWriter) HandleCSP() error
- func (i *InjectedWriter) HandleCSPForText(text string) string
- func (i *InjectedWriter) HandleLine(line string) (string, error)
- func (i InjectedWriter) Header() http.Header
- func (i *InjectedWriter) Write(bytes []byte) (int, error)
- func (i *InjectedWriter) WriteHeader(statusCode int)
- type LineHandler
- type Middleware
- func (Middleware) CaddyModule() caddy.ModuleInfo
- func (m Middleware) IsWebSocket(r *http.Request) bool
- func (m *Middleware) Provision(ctx caddy.Context) error
- func (m Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error
- func (m Middleware) ShouldBypassForRequest(w http.ResponseWriter, r *http.Request) bool
- func (m Middleware) ShouldBypassForResponse(w http.ResponseWriter) bool
- func (m *Middleware) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
- func (m *Middleware) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateRandomBytes ¶ added in v0.4.0
func GenerateRandomStringURLSafe ¶ added in v0.4.0
Types ¶
type ContentTypeStatus ¶
type ContentTypeStatus int
type InjectedWriter ¶
type InjectedWriter struct { OriginalWriter http.ResponseWriter Request *http.Request RecordedHTML bytes.Buffer Logger *zap.Logger LineHandler LineHandler M *Middleware // contains filtered or unexported fields }
func CreateInjectedWriter ¶ added in v0.3.0
func CreateInjectedWriter( w http.ResponseWriter, r *http.Request, m *Middleware, ) *InjectedWriter
func (*InjectedWriter) Flush ¶ added in v0.3.2
func (i *InjectedWriter) Flush() error
func (*InjectedWriter) HandleCSP ¶ added in v0.4.0
func (i *InjectedWriter) HandleCSP() error
func (*InjectedWriter) HandleCSPForText ¶ added in v0.4.0
func (i *InjectedWriter) HandleCSPForText(text string) string
func (*InjectedWriter) HandleLine ¶ added in v0.3.1
func (i *InjectedWriter) HandleLine(line string) (string, error)
func (InjectedWriter) Header ¶
func (i InjectedWriter) Header() http.Header
func (*InjectedWriter) WriteHeader ¶
func (i *InjectedWriter) WriteHeader(statusCode int)
type LineHandler ¶
type Middleware ¶
type Middleware struct { // Regex to specify which kind of response should we filter ContentType string `json:"content_type"` Inject string `json:"inject"` Before string `json:"before"` Logger *zap.Logger // contains filtered or unexported fields }
func (Middleware) CaddyModule ¶
func (Middleware) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (Middleware) IsWebSocket ¶ added in v0.5.0
func (m Middleware) IsWebSocket(r *http.Request) bool
func (*Middleware) Provision ¶
func (m *Middleware) Provision(ctx caddy.Context) error
Provision implements caddy.Provisioner.
func (Middleware) ServeHTTP ¶
func (m Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error
ServeHTTP implements caddyhttp.MiddlewareHandler.
func (Middleware) ShouldBypassForRequest ¶ added in v0.5.0
func (m Middleware) ShouldBypassForRequest(w http.ResponseWriter, r *http.Request) bool
func (Middleware) ShouldBypassForResponse ¶ added in v0.5.0
func (m Middleware) ShouldBypassForResponse(w http.ResponseWriter) bool
func (*Middleware) UnmarshalCaddyfile ¶
func (m *Middleware) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
UnmarshalCaddyfile implements caddyfile.Unmarshaler.
func (*Middleware) Validate ¶
func (m *Middleware) Validate() error
Validate implements caddy.Validator.
Click to show internal directories.
Click to hide internal directories.