handler

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortAgents added in v0.1.3

func SortAgents(agents []models.Agent)

Types

type AccountHandler

type AccountHandler struct {
	// contains filtered or unexported fields
}

func NewAccountHandler

func NewAccountHandler(accountService *service.AccountService) *AccountHandler

func (AccountHandler) GetAuthConfig

func (r AccountHandler) GetAuthConfig(c echo.Context) error

GetAuthConfig 获取认证配置

func (AccountHandler) GetCurrentUser

func (r AccountHandler) GetCurrentUser(c echo.Context) error

GetCurrentUser 获取当前登录用户信息

func (AccountHandler) GetGitHubAuthURL

func (r AccountHandler) GetGitHubAuthURL(c echo.Context) error

GetGitHubAuthURL 获取 GitHub 认证 URL

func (AccountHandler) GetOIDCAuthURL

func (r AccountHandler) GetOIDCAuthURL(c echo.Context) error

GetOIDCAuthURL 获取 OIDC 认证 URL

func (AccountHandler) GitHubLogin

func (r AccountHandler) GitHubLogin(c echo.Context) error

GitHubLogin GitHub 登录回调

func (AccountHandler) Login

func (r AccountHandler) Login(c echo.Context) error

Login 用户登录(Basic Auth)

func (AccountHandler) Logout

func (r AccountHandler) Logout(c echo.Context) error

Logout 用户登出

func (AccountHandler) OIDCLogin

func (r AccountHandler) OIDCLogin(c echo.Context) error

OIDCLogin OIDC 登录回调

func (AccountHandler) ValidateToken

func (r AccountHandler) ValidateToken(tokenString string) (*service.JWTClaims, error)

ValidateToken 验证 token(供中间件使用)

type AgentHandler

type AgentHandler struct {
	// contains filtered or unexported fields
}

func NewAgentHandler

func NewAgentHandler(logger *zap.Logger, agentService *service.AgentService, trafficService *service.TrafficService,
	metricService *service.MetricService, monitorService *service.MonitorService, tamperService *service.TamperService,
	ddnsService *service.DDNSService, sshLoginService *service.SSHLoginService, apiKeyService *service.ApiKeyService,
	propertyService *service.PropertyService, wsManager *ws.Manager) *AgentHandler

func (*AgentHandler) BatchUpdateTags

func (h *AgentHandler) BatchUpdateTags(c echo.Context) error

BatchUpdateTags 批量更新探针标签

func (*AgentHandler) BatchUpdateVisibility added in v0.1.3

func (h *AgentHandler) BatchUpdateVisibility(c echo.Context) error

BatchUpdateVisibility 批量更新探针可见性

func (*AgentHandler) Delete

func (h *AgentHandler) Delete(c echo.Context) error

Delete 删除探针

func (*AgentHandler) DownloadAgent

func (h *AgentHandler) DownloadAgent(c echo.Context) error

DownloadAgent 下载 Agent 二进制文件

func (*AgentHandler) Get

func (h *AgentHandler) Get(c echo.Context) error

Get 获取探针详情(公开接口,已登录返回全部,未登录返回公开可见)

func (*AgentHandler) GetAdminLatestMetrics added in v0.1.1

func (h *AgentHandler) GetAdminLatestMetrics(c echo.Context) error

GetAdminLatestMetrics 获取探针最新指标(管理员接口,显示完整信息)

func (*AgentHandler) GetAgentVersion

func (h *AgentHandler) GetAgentVersion(c echo.Context) error

GetAgentVersion 获取 Agent 版本信息

func (*AgentHandler) GetAgents

func (h *AgentHandler) GetAgents(c echo.Context) error

GetAgents 获取探针列表(公开接口,已登录返回全部,未登录返回公开可见)

func (*AgentHandler) GetAuditResult

func (h *AgentHandler) GetAuditResult(c echo.Context) error

GetAuditResult 获取审计结果(原始数据)

func (*AgentHandler) GetAvailableNetworkInterfaces

func (h *AgentHandler) GetAvailableNetworkInterfaces(c echo.Context) error

GetAvailableNetworkInterfaces 获取探针的可用网卡列表(公开接口,已登录返回全部,未登录返回公开可见)

func (*AgentHandler) GetForAdmin

func (h *AgentHandler) GetForAdmin(c echo.Context) error

GetForAdmin 获取探针详情(管理员接口,显示完整信息)

func (*AgentHandler) GetInstallScript

func (h *AgentHandler) GetInstallScript(c echo.Context) error

GetInstallScript 生成自动安装脚本

func (*AgentHandler) GetLatestMetrics

func (h *AgentHandler) GetLatestMetrics(c echo.Context) error

GetLatestMetrics 获取探针最新指标(公开接口,已登录返回全部,未登录返回公开可见)

func (*AgentHandler) GetMetrics

func (h *AgentHandler) GetMetrics(c echo.Context) error

GetMetrics 获取探针聚合指标(公开接口,已登录返回全部,未登录返回公开可见)

func (*AgentHandler) GetServerUrl added in v0.0.17

func (h *AgentHandler) GetServerUrl(c echo.Context) error

func (*AgentHandler) GetStatistics

func (h *AgentHandler) GetStatistics(c echo.Context) error

GetStatistics 获取探针统计数据

func (*AgentHandler) GetTags

func (h *AgentHandler) GetTags(c echo.Context) error

GetTags 获取所有探针的标签

func (*AgentHandler) GetTrafficStats

func (h *AgentHandler) GetTrafficStats(c echo.Context) error

GetTrafficStats 查询流量统计(管理员接口)

func (*AgentHandler) HandleWebSocket

func (h *AgentHandler) HandleWebSocket(c echo.Context) error

HandleWebSocket 处理WebSocket连接

func (*AgentHandler) ListAuditResults

func (h *AgentHandler) ListAuditResults(c echo.Context) error

ListAuditResults 获取审计结果列表

func (*AgentHandler) Paging

func (h *AgentHandler) Paging(c echo.Context) error

Paging 探针分页查询(返回完整列表,前端实现过滤)

func (*AgentHandler) ResetAgentTraffic

func (h *AgentHandler) ResetAgentTraffic(c echo.Context) error

ResetAgentTraffic 手动重置流量(管理员)

func (*AgentHandler) SendCommand

func (h *AgentHandler) SendCommand(c echo.Context) error

SendCommand 向探针发送指令

func (*AgentHandler) UpdateInfo

func (h *AgentHandler) UpdateInfo(c echo.Context) error

UpdateInfo 更新探针信息(名称、标签、到期时间、可见性、权重、备注)

func (*AgentHandler) UpdateTrafficConfig

func (h *AgentHandler) UpdateTrafficConfig(c echo.Context) error

UpdateTrafficConfig 更新流量配置(管理员)

type AlertHandler

type AlertHandler struct {
	// contains filtered or unexported fields
}

func NewAlertHandler

func NewAlertHandler(logger *zap.Logger, alertService *service.AlertService) *AlertHandler

func (*AlertHandler) ClearAlertRecords

func (h *AlertHandler) ClearAlertRecords(c echo.Context) error

ClearAlertRecords 清空告警记录

func (*AlertHandler) ListAlertRecords

func (h *AlertHandler) ListAlertRecords(c echo.Context) error

ListAlertRecords 列出告警记录

type ApiKeyHandler

type ApiKeyHandler struct {
	// contains filtered or unexported fields
}

func NewApiKeyHandler

func NewApiKeyHandler(logger *zap.Logger, apiKeyService *service.ApiKeyService) *ApiKeyHandler

func (ApiKeyHandler) Create

func (r ApiKeyHandler) Create(c echo.Context) error

Create 生成API密钥

func (ApiKeyHandler) Delete

func (r ApiKeyHandler) Delete(c echo.Context) error

Delete 删除API密钥

func (ApiKeyHandler) Disable

func (r ApiKeyHandler) Disable(c echo.Context) error

Disable 禁用API密钥

func (ApiKeyHandler) Enable

func (r ApiKeyHandler) Enable(c echo.Context) error

Enable 启用API密钥

func (ApiKeyHandler) Get

func (r ApiKeyHandler) Get(c echo.Context) error

Get 获取API密钥详情

func (ApiKeyHandler) Paging

func (r ApiKeyHandler) Paging(c echo.Context) error

Paging API密钥分页查询

func (ApiKeyHandler) Update

func (r ApiKeyHandler) Update(c echo.Context) error

Update 更新API密钥名称

type CreateConfigRequest

type CreateConfigRequest struct {
	AgentID       string   `json:"agentId" validate:"required"`
	Name          string   `json:"name" validate:"required"`
	Provider      string   `json:"provider" validate:"required"`
	DomainsIPv4   []string `json:"domainsIpv4"`
	DomainsIPv6   []string `json:"domainsIpv6"`
	EnableIPv4    bool     `json:"enableIpv4"`
	EnableIPv6    bool     `json:"enableIpv6"`
	IPv4GetMethod string   `json:"ipv4GetMethod"`
	IPv6GetMethod string   `json:"ipv6GetMethod"`
	IPv4GetValue  string   `json:"ipv4GetValue"`
	IPv6GetValue  string   `json:"ipv6GetValue"`
}

CreateConfigRequest 创建 DDNS 配置请求

type DDNSHandler

type DDNSHandler struct {
	// contains filtered or unexported fields
}

func NewDDNSHandler

func NewDDNSHandler(logger *zap.Logger, ddnsService *service.DDNSService) *DDNSHandler

func (*DDNSHandler) Create

func (h *DDNSHandler) Create(c echo.Context) error

Create 创建 DDNS 配置

func (*DDNSHandler) Delete

func (h *DDNSHandler) Delete(c echo.Context) error

Delete 删除 DDNS 配置

func (*DDNSHandler) Disable

func (h *DDNSHandler) Disable(c echo.Context) error

Disable 禁用 DDNS 配置

func (*DDNSHandler) Enable

func (h *DDNSHandler) Enable(c echo.Context) error

Enable 启用 DDNS 配置

func (*DDNSHandler) Get

func (h *DDNSHandler) Get(c echo.Context) error

Get 获取 DDNS 配置详情

func (*DDNSHandler) GetRecords

func (h *DDNSHandler) GetRecords(c echo.Context) error

GetRecords 获取 DDNS 更新记录

func (*DDNSHandler) Paging

func (h *DDNSHandler) Paging(c echo.Context) error

Paging DDNS 配置分页查询

func (*DDNSHandler) TriggerUpdate added in v0.1.1

func (h *DDNSHandler) TriggerUpdate(c echo.Context) error

TriggerUpdate 手动触发 DDNS 更新

func (*DDNSHandler) Update

func (h *DDNSHandler) Update(c echo.Context) error

Update 更新 DDNS 配置

type DNSProviderHandler

type DNSProviderHandler struct {
	// contains filtered or unexported fields
}

func NewDNSProviderHandler

func NewDNSProviderHandler(logger *zap.Logger, propertyService *service.PropertyService) *DNSProviderHandler

func (*DNSProviderHandler) Delete

func (h *DNSProviderHandler) Delete(c echo.Context) error

Delete 删除 DNS Provider 配置

func (*DNSProviderHandler) GetAll

func (h *DNSProviderHandler) GetAll(c echo.Context) error

GetAll 获取所有 DNS Provider 配置(脱敏)

func (*DNSProviderHandler) Upsert

func (h *DNSProviderHandler) Upsert(c echo.Context) error

Upsert 创建或更新 DNS Provider 配置

type DNSProviderRequest

type DNSProviderRequest struct {
	Provider string                 `json:"provider"` // 服务商类型
	Enabled  bool                   `json:"enabled"`  // 是否启用
	Config   map[string]interface{} `json:"config"`   // 配置对象
}

DNSProviderRequest 创建/更新 DNS Provider 请求

type DNSProviderResponse

type DNSProviderResponse struct {
	Provider string                 `json:"provider"` // 服务商类型
	Enabled  bool                   `json:"enabled"`  // 是否启用
	Config   map[string]interface{} `json:"config"`   // 配置对象(已脱敏)
}

DNSProviderResponse DNS Provider 响应(脱敏)

type GenerateApiKeyRequest

type GenerateApiKeyRequest struct {
	Name string `json:"name" validate:"required"`
}

GenerateApiKeyRequest 生成API密钥请求

type GitHubLoginRequest

type GitHubLoginRequest struct {
	Code  string `json:"code" validate:"required"`
	State string `json:"state" validate:"required"`
}

GitHubLoginRequest GitHub 登录请求

type LoginRequest

type LoginRequest struct {
	Username string `json:"username" validate:"required"`
	Password string `json:"password" validate:"required"`
}

LoginRequest 登录请求

type MonitorHandler

type MonitorHandler struct {
	// contains filtered or unexported fields
}

func NewMonitorHandler

func NewMonitorHandler(logger *zap.Logger, monitorService *service.MonitorService, metricService *service.MetricService, agentService *service.AgentService) *MonitorHandler

func (*MonitorHandler) Create

func (h *MonitorHandler) Create(c echo.Context) error

func (*MonitorHandler) Delete

func (h *MonitorHandler) Delete(c echo.Context) error

func (*MonitorHandler) Get

func (h *MonitorHandler) Get(c echo.Context) error

func (*MonitorHandler) GetAgentStatsByID

func (h *MonitorHandler) GetAgentStatsByID(c echo.Context) error

GetAgentStatsByID 获取指定监控任务各探针的统计数据(公开接口,已登录返回全部,未登录返回公开可见)

func (*MonitorHandler) GetHistoryByID

func (h *MonitorHandler) GetHistoryByID(c echo.Context) error

GetHistoryByID 获取指定监控任务的历史响应时间数据(公开接口,已登录返回全部,未登录返回公开可见)

func (*MonitorHandler) GetMonitors

func (h *MonitorHandler) GetMonitors(c echo.Context) error

GetMonitors 获取所有监控统计数据

func (*MonitorHandler) GetStatsByID

func (h *MonitorHandler) GetStatsByID(c echo.Context) error

GetStatsByID 获取指定监控任务的统计数据(公开接口,已登录返回全部,未登录返回公开可见)

func (*MonitorHandler) List

func (h *MonitorHandler) List(c echo.Context) error

func (*MonitorHandler) Update

func (h *MonitorHandler) Update(c echo.Context) error

type OIDCLoginRequest

type OIDCLoginRequest struct {
	Code  string `json:"code" validate:"required"`
	State string `json:"state" validate:"required"`
}

OIDCLoginRequest OIDC 登录请求

type PropertyHandler

type PropertyHandler struct {
	// contains filtered or unexported fields
}

func NewPropertyHandler

func NewPropertyHandler(logger *zap.Logger, service *service.PropertyService, notifier *service.Notifier) *PropertyHandler
func (h *PropertyHandler) GetLogo(c echo.Context) error

GetLogo 获取系统 Logo(公开访问,返回图片文件流)

func (*PropertyHandler) GetProperty

func (h *PropertyHandler) GetProperty(c echo.Context) error

GetProperty 获取属性(返回 JSON 值)

func (*PropertyHandler) SetProperty

func (h *PropertyHandler) SetProperty(c echo.Context) error

SetProperty 设置属性

func (*PropertyHandler) TestNotificationChannel

func (h *PropertyHandler) TestNotificationChannel(c echo.Context) error

TestNotificationChannel 测试通知渠道(从数据库读取配置)

type SSHLoginHandler added in v0.1.1

type SSHLoginHandler struct {
	// contains filtered or unexported fields
}

SSHLoginHandler SSH登录处理器

func NewSSHLoginHandler added in v0.1.1

func NewSSHLoginHandler(logger *zap.Logger, service *service.SSHLoginService) *SSHLoginHandler

NewSSHLoginHandler 创建处理器

func (*SSHLoginHandler) DeleteEvents added in v0.1.1

func (h *SSHLoginHandler) DeleteEvents(c echo.Context) error

DeleteEvents 删除探针的所有SSH登录事件 DELETE /api/agents/:id/ssh-login/events

func (*SSHLoginHandler) GetConfig added in v0.1.1

func (h *SSHLoginHandler) GetConfig(c echo.Context) error

GetConfig 获取SSH登录监控配置 GET /api/agents/:id/ssh-login/config

func (*SSHLoginHandler) GetEvent added in v0.1.1

func (h *SSHLoginHandler) GetEvent(c echo.Context) error

GetEvent 获取单个SSH登录事件 GET /api/ssh-login/events/:id

func (*SSHLoginHandler) ListEvents added in v0.1.1

func (h *SSHLoginHandler) ListEvents(c echo.Context) error

ListEvents 查询SSH登录事件 GET /api/agents/:id/ssh-login/events

func (*SSHLoginHandler) UpdateConfig added in v0.1.1

func (h *SSHLoginHandler) UpdateConfig(c echo.Context) error

UpdateConfig 更新SSH登录监控配置 POST /api/agents/:id/ssh-login/config

type TamperHandler

type TamperHandler struct {
	// contains filtered or unexported fields
}

func NewTamperHandler

func NewTamperHandler(logger *zap.Logger, tamperService *service.TamperService) *TamperHandler

func (*TamperHandler) DeleteEvents added in v0.1.1

func (h *TamperHandler) DeleteEvents(c echo.Context) error

func (*TamperHandler) GetConfig added in v0.1.1

func (h *TamperHandler) GetConfig(c echo.Context) error

GetConfig 获取探针的防篡改配置 GET /api/agents/:id/tamper/config

func (*TamperHandler) ListEvents added in v0.1.1

func (h *TamperHandler) ListEvents(c echo.Context) error

ListEvents 获取探针的防篡改事件 GET /api/agents/:id/tamper/events

func (*TamperHandler) UpdateConfig added in v0.1.1

func (h *TamperHandler) UpdateConfig(c echo.Context) error

UpdateConfig 更新探针的防篡改配置 POST /api/agents/:id/tamper/config

type UpdateApiKeyNameRequest

type UpdateApiKeyNameRequest struct {
	Name string `json:"name" validate:"required"`
}

UpdateApiKeyNameRequest 更新API密钥名称请求

type UpdateConfigRequest

type UpdateConfigRequest struct {
	Name          string   `json:"name"`
	Provider      string   `json:"provider"`
	DomainsIPv4   []string `json:"domainsIpv4"`
	DomainsIPv6   []string `json:"domainsIpv6"`
	EnableIPv4    bool     `json:"enableIpv4"`
	EnableIPv6    bool     `json:"enableIpv6"`
	IPv4GetMethod string   `json:"ipv4GetMethod"`
	IPv6GetMethod string   `json:"ipv6GetMethod"`
	IPv4GetValue  string   `json:"ipv4GetValue"`
	IPv6GetValue  string   `json:"ipv6GetValue"`
}

UpdateConfigRequest 更新 DDNS 配置请求

Jump to

Keyboard shortcuts

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