module

package
v0.0.0-...-8ff0d35 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomHeader

type CustomHeader struct {
	HeaderName  string `json:"header_name,omitempty"`
	HeaderValue string `json:"header_value,omitempty"`
}

CustomHeader is an example handler that adds a custom header to the response

func (CustomHeader) CaddyModule

func (CustomHeader) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (CustomHeader) ServeHTTP

func (ch CustomHeader) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error

ServeHTTP implements caddyhttp.MiddlewareHandler.

func (*CustomHeader) UnmarshalCaddyfile

func (ch *CustomHeader) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile implements caddyfile.Unmarshaler.

type MyHandler

type MyHandler struct {
	Message string `json:"message"`
}

MyHandler 是一个自定义的 HTTP handler 模块

func (MyHandler) CaddyModule

func (MyHandler) CaddyModule() caddy.ModuleInfo

CaddyModule 返回 Caddy 模块的信息

func (MyHandler) ServeHTTP

func (h MyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error

ServeHTTP 实现了 caddyhttp.MiddlewareHandler 接口

func (*MyHandler) UnmarshalCaddyfile

func (h *MyHandler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile 实现了解析 Caddyfile 配置的方法

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL