caddyApi

package
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: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CaddyUrl = "http://localhost:2025/"

Functions

func ActivateProtection

func ActivateProtection(c *gin.Context)

开启指定防护 protection manager.go

func AddIpWhiteList

func AddIpWhiteList(c *gin.Context)

添加ip白名单

func AddRule

func AddRule(c *gin.Context)

增加规则 参数:站点名,规则内容

func AddRuleIpList added in v0.0.92

func AddRuleIpList(c *gin.Context)

添加黑白名单

func AddSite

func AddSite(c *gin.Context)

添加站点

func CaddyAPI

func CaddyAPI(r *gin.Engine, randomString string)

修改caddy配置API

func DeactivateProtection

func DeactivateProtection(c *gin.Context)

关闭某项防护

func DelIpWhiteList

func DelIpWhiteList(c *gin.Context)

删除ip白名单

func DelRule

func DelRule(c *gin.Context)

根据ID删除规则

func DelRuleIpList added in v0.0.92

func DelRuleIpList(c *gin.Context)

根据ip删除黑白名单ip

func DelSite

func DelSite(c *gin.Context)

删除多个站点

func GetAndSetConfFile

func GetAndSetConfFile() string

GetAndSetConfFile 获取配置,同步给本地caddy.json

func GetIpList

func GetIpList(c *gin.Context)

获取白名单集合 // config请求

func GetProtectList

func GetProtectList(c *gin.Context)

GetProtectList 获取防护集合 读取配置文件中以 Include 开头的规则

func GetProtectType added in v0.0.92

func GetProtectType(c *gin.Context)

获取所有防护类型

func GetRuleIpList added in v0.0.92

func GetRuleIpList(c *gin.Context)

查询黑白名单ip

func GetRulesList

func GetRulesList(c *gin.Context)

读取配置文件中以 SecRule REQUEST_URI 开头的规则、

func GetSiteList

func GetSiteList(c *gin.Context)

获取站点列表以及各项信息

func ReloadCaddy

func ReloadCaddy(c *gin.Context) error

强制重载配置

func RunCaddy

func RunCaddy(c *gin.Context)

func StopCaddy

func StopCaddy(c *gin.Context)

func UpdateProtection added in v0.0.92

func UpdateProtection(c *gin.Context)

修改防护配置

Types

type AddRules added in v0.0.92

type AddRules struct {
	SiteName   string   `json:"site_name"`
	ConfigList []string `json:"config_list"`
}

type AllRules added in v0.0.92

type AllRules struct {
	RuleId  string `json:"rule_id"`
	RuleMsg string `json:"rule_msg"`
}

返回规则id和描述

type AutoHttps added in v0.0.92

type AutoHttps struct {
	Disable bool `json:"disable"`
}

type IpList added in v0.0.92

type IpList struct {
	SiteName  string   `json:"site_name,omitempty"`
	Blacklist []string `json:"blacklist"`
	Whitelist []string `json:"whitelist"`
}

type Server added in v0.0.92

type Server struct {
	Listen    []string  `json:"listen"` // 监听端口数组
	AutoHttps AutoHttps `json:"automatic_https"`
}

Server 定义服务器配置的结构,仅包含 listen 字段

type SiteName added in v0.0.92

type SiteName struct {
	SiteNameList []string `json:"site_name_list"`
}

Jump to

Keyboard shortcuts

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