caddy_api_module

package module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: MulanPSL-2.0 Imports: 11 Imported by: 0

README

caddy-api-module

介绍

coraza-caddy的动态API配置

安装教程
  1. xxxx
  2. xxxx
  3. xxxx
使用说明
  1. xxxx
  2. xxxx
  3. xxxx
参与贡献
  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request
特技
  1. 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md
  2. Gitee 官方博客 blog.gitee.com
  3. 你可以 https://gitee.com/explore 这个地址来了解 Gitee 上的优秀开源项目
  4. GVP 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
  5. Gitee 官方提供的使用手册 https://gitee.com/help
  6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 https://gitee.com/gitee-stars/

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IPFilter added in v0.0.6

func IPFilter(allowedIPs []string) gin.HandlerFunc

IP 校验中间件

Types

type CaddyAPIModule

type CaddyAPIModule struct {
	ApiResponse string   `json:"api_response,omitempty"` // 响应的文本
	ApiPort     string   `json:"api_port,omitempty"`     // 内部监听的端口号
	ApiUrl32    string   `json:"api_url32,omitempty"`    // 校验的请求头信息
	AllowedIPs  []string `json:"allowed_ips,omitempty"`  // 允许访问的 IP 列表
}

CaddyAPIModule 插件获取参数的结构体

func (*CaddyAPIModule) CaddyModule

func (api *CaddyAPIModule) CaddyModule() caddy.ModuleInfo

CaddyModule 返回模块信息(编译完成/运行时 先调用的)完成之后再调用

func (*CaddyAPIModule) Provision

func (api *CaddyAPIModule) Provision(ctx caddy.Context) error

Provision 是初始化方法,在这里启动路由(4)

func (*CaddyAPIModule) ServeHTTP

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

ServeHTTP 是处理 HTTP 请求的方法(6)

func (*CaddyAPIModule) UnmarshalCaddyfile

func (api *CaddyAPIModule) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile 从 Caddyfile 中解析配置(3)

func (CaddyAPIModule) Validate

func (api CaddyAPIModule) Validate() error

Validate 是校验方法,校验传递的值是否合法(5)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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