audit

package
v0.20.27 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeAuth     = "auth"
	TypeSecurity = "security"
	TypeConfig   = "config"
	TypeEvent    = "event"
	MaxLogs      = 1000
	PageSize     = 20

	TriggerReasonOffline    = "offline"
	TriggerReasonHighCPU    = "high_cpu"
	TriggerReasonHighMemory = "high_memory"
)

Variables

This section is empty.

Functions

func BuildConfigSettingDetail

func BuildConfigSettingDetail(before *model.Config, in SettingChangeInput) string

BuildConfigSettingDetail 非安全类站点配置变更。

func BuildSecuritySettingDetail

func BuildSecuritySettingDetail(before *model.Config, in SettingChangeInput) string

BuildSecuritySettingDetail 安全相关配置变更(登录、权限、API 边界等)。

func OnServerWatchTrigger

func OnServerWatchTrigger(serverID uint64, reason string)

OnServerWatchTrigger 服务器离线、持续高 CPU/内存时触发回调,供后续扩展通知/Webhook 等。

func PruneExcess

func PruneExcess()

PruneExcess 删除超出上限的最旧日志。

func Record

func Record(c *gin.Context, typ, action, detail string)

Record 写入一条审计日志(忽略写入错误,避免影响主流程)。

func StartWatchdog

func StartWatchdog()

StartWatchdog 启动后台巡检:意外关机检测、服务器上下线日志。

Types

type SettingChangeInput

type SettingChangeInput struct {
	Title                           string
	Admin                           string
	Language                        string
	Theme                           string
	DashboardTheme                  string
	CustomCodeChanged               bool
	CustomCodeDashboardChanged      bool
	ViewPasswordChanged             bool
	CustomNameservers               string
	UseExternalGeoIP                bool
	EnableIPChangeNotification      bool
	EnablePlainIPInNotification     bool
	DisableSwitchTemplateInFrontend bool
	CompatAPIDisable                bool
	UseTemplateHandleNoRoute        bool
	DisableOauthLogin               bool
	DisablePasswordLogin            bool
	GRPCHost                        string
	GRPCDiscoverKey                 string
	Cover                           uint8
	IgnoredIPNotification           string
	IPChangeNotificationTag         string
	PasswordChanged                 bool
	TwoFactorCleared                bool
}

SettingChangeInput 设置保存后的目标值(用于生成变更详情,不含敏感内容)。

type TypeOption

type TypeOption struct {
	ID    string `json:"id"`
	Label string `json:"label"`
}

func TypeOptions

func TypeOptions() []TypeOption

TypeOptions 供筛选使用

Jump to

Keyboard shortcuts

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