Documentation
¶
Index ¶
- Constants
- Variables
- func AdminMFASettings(db *gorm.DB) (map[string]any, error)
- func ClampPagination(page, pageSize int) (int, int)
- func FinalizeIdentity(c *gin.Context)
- func IdentityJWKS(c *gin.Context)
- func IdentityLogout(c *gin.Context)
- func IdentityStatus(c *gin.Context)
- func LoadNotificationEmailConfig(db *gorm.DB) (*model.EmailConfig, error)
- func NewV2CompatibilityGateway(cfg *config.Config, cache *compatv2.VerifiedRouteCache) *compatv2.Gateway
- func NewV2RouteCache() *compatv2.VerifiedRouteCache
- func NewV2WebSocketGateway(cfg *config.Config, cache *compatv2.VerifiedRouteCache) *compatv2.WebSocketGateway
- func PublicConfigHandler(cfg *config.Config) gin.HandlerFunc
- func StartIdentityCutover(c *gin.Context)
- func StartIdentityImport(c *gin.Context)
- func StartIdentityRollback(c *gin.Context)
- type AdminAPITokensHandler
- type AdminBulkHandler
- type AdminCouponHandler
- type AdminGroupMembersHandler
- type AdminHandler
- func (h *AdminHandler) AssignPlanToUser(c *gin.Context)
- func (h *AdminHandler) BanUser(c *gin.Context)
- func (h *AdminHandler) CancelOrder(c *gin.Context)
- func (h *AdminHandler) CreatePlan(c *gin.Context)
- func (h *AdminHandler) CreateUser(c *gin.Context)
- func (h *AdminHandler) DeletePlan(c *gin.Context)
- func (h *AdminHandler) DeleteUser(c *gin.Context)
- func (h *AdminHandler) GetDashboard(c *gin.Context)
- func (h *AdminHandler) GetHourlyTraffic(c *gin.Context)
- func (h *AdminHandler) GetOrder(c *gin.Context)
- func (h *AdminHandler) GetOrderList(c *gin.Context)
- func (h *AdminHandler) GetOrderStats(c *gin.Context)
- func (h *AdminHandler) GetPlan(c *gin.Context)
- func (h *AdminHandler) GetPlans(c *gin.Context)
- func (h *AdminHandler) GetSystemInfo(c *gin.Context)
- func (h *AdminHandler) GetUser(c *gin.Context)
- func (h *AdminHandler) GetUserList(c *gin.Context)
- func (h *AdminHandler) GetUserStats(c *gin.Context)
- func (h *AdminHandler) GetUserTrafficRanking(c *gin.Context)
- func (h *AdminHandler) MarkOrderPaid(c *gin.Context)
- func (h *AdminHandler) ResetCompatFlow(c *gin.Context)
- func (h *AdminHandler) ResetUserSubscribe(c *gin.Context)
- func (h *AdminHandler) ResetUserTraffic(c *gin.Context)
- func (h *AdminHandler) UnbanUser(c *gin.Context)
- func (h *AdminHandler) UpdateOrderStatus(c *gin.Context)
- func (h *AdminHandler) UpdatePlan(c *gin.Context)
- func (h *AdminHandler) UpdateUser(c *gin.Context)
- type AdminKnowledgeHandler
- type AdminTicketHandler
- type AdminUserActivityHandler
- type AgentConnection
- type AgentHandler
- func (h *AgentHandler) AgentGetForwardRules(c *gin.Context)
- func (h *AgentHandler) AgentGetTasks(c *gin.Context)
- func (h *AgentHandler) AgentHeartbeat(c *gin.Context)
- func (h *AgentHandler) AgentMonitor(c *gin.Context)
- func (h *AgentHandler) AgentRegister(c *gin.Context)
- func (h *AgentHandler) AgentReportResult(c *gin.Context)
- func (h *AgentHandler) AgentWebSocketUnified(c *gin.Context)
- func (h *AgentHandler) CreateTask(c *gin.Context)
- func (h *AgentHandler) ExecuteCommand(c *gin.Context)
- func (h *AgentHandler) GetMonitor(c *gin.Context)
- func (h *AgentHandler) GetTaskResult(c *gin.Context)
- func (h *AgentHandler) ListAgents(c *gin.Context)
- func (h *AgentHandler) ListDiagnosticTasks(c *gin.Context)
- func (h *AgentHandler) PrepareWebSocketBridge(c *gin.Context) bool
- func (h *AgentHandler) RequireAgentNode(c *gin.Context)
- func (h *AgentHandler) WebSockets() agentstreams.WebSockets
- type AgentHeartbeatRequest
- type AgentInstallHandler
- type AgentMonitorRequest
- type AgentMonitorSnapshot
- type AgentPKIHandler
- type AgentRegisterRequest
- type AgentTask
- type AgentTaskResult
- type AgentTransportsHandler
- type AgentUpgradesHandler
- func (h *AgentUpgradesHandler) Abort(c *gin.Context)
- func (h *AgentUpgradesHandler) Get(c *gin.Context)
- func (h *AgentUpgradesHandler) List(c *gin.Context)
- func (h *AgentUpgradesHandler) Pause(c *gin.Context)
- func (h *AgentUpgradesHandler) Resume(c *gin.Context)
- func (h *AgentUpgradesHandler) Start(c *gin.Context)
- type AuthHandler
- type BroadcastRequest
- type BulkActionRoute
- type BulkAnswer
- type BulkCall
- type BulkError
- type BulkItemResult
- type BulkResult
- type BulkRunner
- type CouponHandler
- type CreateGatewayRequest
- type CreateNodeRequest
- type CreatePaymentRequest
- type CreateRuleRequest
- type CreateTaskRequest
- type DeltaData
- type ExecuteCommandRequest
- type ForwardCleanAgentHandler
- type ForwardHandler
- func (h *ForwardHandler) AssignPanelUserTunnel(c *gin.Context)
- func (h *ForwardHandler) CreatePanelTunnel(c *gin.Context)
- func (h *ForwardHandler) DeletePanelTunnel(c *gin.Context)
- func (h *ForwardHandler) DiagnoseLocalRuntime(c *gin.Context)
- func (h *ForwardHandler) DiagnoseNodeXRuntime(c *gin.Context)
- func (h *ForwardHandler) DiagnosePanelRuntime(c *gin.Context)
- func (h *ForwardHandler) GetForwardStats(c *gin.Context)
- func (h *ForwardHandler) GetLocalRuntimeStatus(c *gin.Context)
- func (h *ForwardHandler) GetNodeXRuntimeStatus(c *gin.Context)
- func (h *ForwardHandler) GetObservabilityMultiIngress(c *gin.Context)
- func (h *ForwardHandler) GetPanelRuntimeStatus(c *gin.Context)
- func (h *ForwardHandler) GetUserRules(c *gin.Context)
- func (h *ForwardHandler) ListPanelAdminTunnels(c *gin.Context)
- func (h *ForwardHandler) ListPanelForwards(c *gin.Context)
- func (h *ForwardHandler) ListPanelTunnels(c *gin.Context)
- func (h *ForwardHandler) ListPanelUserTunnels(c *gin.Context)
- func (h *ForwardHandler) ReportPanelForwardTraffic(c *gin.Context)
- func (h *ForwardHandler) SnapshotPanelForwardTraffic(c *gin.Context)
- func (h *ForwardHandler) TestGostConnection(c *gin.Context)
- func (h *ForwardHandler) UpdatePanelForwardOrder(c *gin.Context)
- func (h *ForwardHandler) UploadPanelFlowData(c *gin.Context)
- type ForwardRuleForAgent
- type ForwardV4Docs
- func (ForwardV4Docs) CreateAnsibleMachine(*gin.Context)
- func (ForwardV4Docs) CreateDNSBinding(*gin.Context)
- func (ForwardV4Docs) CreateDNSProvider(*gin.Context)
- func (ForwardV4Docs) CreateNode(*gin.Context)
- func (ForwardV4Docs) CreateRoute(*gin.Context)
- func (ForwardV4Docs) DNSKinds(*gin.Context)
- func (ForwardV4Docs) DeleteAnsibleMachine(*gin.Context)
- func (ForwardV4Docs) DeleteDNSBinding(*gin.Context)
- func (ForwardV4Docs) DeleteDNSProvider(*gin.Context)
- func (ForwardV4Docs) DeleteNode(*gin.Context)
- func (ForwardV4Docs) DeleteRoute(*gin.Context)
- func (ForwardV4Docs) DiagnoseRoute(*gin.Context)
- func (ForwardV4Docs) GetAnsibleMachine(*gin.Context)
- func (ForwardV4Docs) GetDNSBinding(*gin.Context)
- func (ForwardV4Docs) GetDNSProvider(*gin.Context)
- func (ForwardV4Docs) GetNode(*gin.Context)
- func (ForwardV4Docs) GetRoute(*gin.Context)
- func (ForwardV4Docs) ListAnsibleMachines(*gin.Context)
- func (ForwardV4Docs) ListDNSBindings(*gin.Context)
- func (ForwardV4Docs) ListDNSProviders(*gin.Context)
- func (ForwardV4Docs) ListNodes(*gin.Context)
- func (ForwardV4Docs) ListRoutes(*gin.Context)
- func (ForwardV4Docs) ObservabilityTargets(*gin.Context)
- func (ForwardV4Docs) ObservabilityTopology(*gin.Context)
- func (ForwardV4Docs) ObservabilityTrend(*gin.Context)
- func (ForwardV4Docs) PauseRoute(*gin.Context)
- func (ForwardV4Docs) PreviewRoute(*gin.Context)
- func (ForwardV4Docs) ResumeRoute(*gin.Context)
- func (ForwardV4Docs) RouteDNS(*gin.Context)
- func (ForwardV4Docs) RouteHealth(*gin.Context)
- func (ForwardV4Docs) RouteStats(*gin.Context)
- func (ForwardV4Docs) SetNodeSettings(*gin.Context)
- func (ForwardV4Docs) Stats(*gin.Context)
- func (ForwardV4Docs) ToggleAnsibleMachine(*gin.Context)
- func (ForwardV4Docs) ToggleNode(*gin.Context)
- func (ForwardV4Docs) UpdateAnsibleMachine(*gin.Context)
- func (ForwardV4Docs) UpdateDNSBinding(*gin.Context)
- func (ForwardV4Docs) UpdateDNSProvider(*gin.Context)
- func (ForwardV4Docs) UpdateNode(*gin.Context)
- func (ForwardV4Docs) UpdateRoute(*gin.Context)
- type InviteCodeAdminHandler
- type InviteHandler
- func (h *InviteHandler) GenerateCode(c *gin.Context)
- func (h *InviteHandler) GetCommissionRecords(c *gin.Context)
- func (h *InviteHandler) GetConfig(c *gin.Context)
- func (h *InviteHandler) GetInviteInfo(c *gin.Context)
- func (h *InviteHandler) GetInviteStats(c *gin.Context)
- func (h *InviteHandler) GetWithdrawRecords(c *gin.Context)
- func (h *InviteHandler) GetWithdrawals(c *gin.Context)
- func (h *InviteHandler) ProcessWithdraw(c *gin.Context)
- func (h *InviteHandler) RequestWithdraw(c *gin.Context)
- func (h *InviteHandler) UpdateConfig(c *gin.Context)
- type KernelAlertsHandler
- type KernelHandler
- func (h *KernelHandler) AddGroupPlan(c *gin.Context)
- func (h *KernelHandler) AddGroupUser(c *gin.Context)
- func (h *KernelHandler) ApplyDeployment(c *gin.Context)
- func (h *KernelHandler) CancelOperation(c *gin.Context)
- func (h *KernelHandler) CreateAccessGroup(c *gin.Context)
- func (h *KernelHandler) CreateOperation(c *gin.Context)
- func (h *KernelHandler) CreateResourceGrant(c *gin.Context)
- func (h *KernelHandler) CreateTopology(c *gin.Context)
- func (h *KernelHandler) CreateTopologyRevision(c *gin.Context)
- func (h *KernelHandler) DeleteAccessGroup(c *gin.Context)
- func (h *KernelHandler) DeleteAssignment(c *gin.Context)
- func (h *KernelHandler) DeleteQuotaPolicy(c *gin.Context)
- func (h *KernelHandler) DeleteResourceGrant(c *gin.Context)
- func (h *KernelHandler) DiagnoseTopologyDeployment(c *gin.Context)
- func (h *KernelHandler) ForwardGateway(c *gin.Context)
- func (h *KernelHandler) ForwardLegacyArchive(c *gin.Context)
- func (h *KernelHandler) GetAccessGroupDetail(c *gin.Context)
- func (h *KernelHandler) GetDeploymentStatus(c *gin.Context)
- func (h *KernelHandler) GetPluginInstallationConfiguration(c *gin.Context)
- func (h *KernelHandler) GetPluginReleaseArtifact(c *gin.Context)
- func (h *KernelHandler) GetTopologyRevision(c *gin.Context)
- func (h *KernelHandler) ListAccessGroups(c *gin.Context)
- func (h *KernelHandler) ListAssignments(c *gin.Context)
- func (h *KernelHandler) ListDeployments(c *gin.Context)
- func (h *KernelHandler) ListExtensions(c *gin.Context)
- func (h *KernelHandler) ListObservedStates(c *gin.Context)
- func (h *KernelHandler) ListOperations(c *gin.Context)
- func (h *KernelHandler) ListPluginInstallations(c *gin.Context)
- func (h *KernelHandler) ListPluginReleases(c *gin.Context)
- func (h *KernelHandler) ListPlugins(c *gin.Context)
- func (h *KernelHandler) ListQuotaPolicies(c *gin.Context)
- func (h *KernelHandler) ListResourceGrants(c *gin.Context)
- func (h *KernelHandler) ListServiceScopes(c *gin.Context)
- func (h *KernelHandler) ListTopologies(c *gin.Context)
- func (h *KernelHandler) ListTopologyRevisions(c *gin.Context)
- func (h *KernelHandler) PlanDeployment(c *gin.Context)
- func (h *KernelHandler) PluginInstallationAction(c *gin.Context)
- func (h *KernelHandler) PluginRouteGateway(c *gin.Context)
- func (h *KernelHandler) PreviewDeployment(c *gin.Context)
- func (h *KernelHandler) PreviewTopologyDeployment(c *gin.Context)
- func (h *KernelHandler) RegisterPluginRelease(c *gin.Context)
- func (h *KernelHandler) RemoveGroupPlan(c *gin.Context)
- func (h *KernelHandler) RemoveGroupUser(c *gin.Context)
- func (h *KernelHandler) ResolveAccess(c *gin.Context)
- func (h *KernelHandler) RollbackDeployment(c *gin.Context)
- func (h *KernelHandler) ServeAgentPluginArtifact(c *gin.Context)
- func (h *KernelHandler) ServeAgentPluginManifest(c *gin.Context)
- func (h *KernelHandler) ServePluginWebUIAsset(c *gin.Context)
- func (h *KernelHandler) UpdateAccessGroup(c *gin.Context)
- func (h *KernelHandler) UpdatePluginInstallationConfiguration(c *gin.Context)
- func (h *KernelHandler) UploadPluginReleaseArtifact(c *gin.Context)
- func (h *KernelHandler) UpsertAssignment(c *gin.Context)
- func (h *KernelHandler) UpsertPluginInstallation(c *gin.Context)
- func (h *KernelHandler) UpsertQuotaPolicy(c *gin.Context)
- func (h *KernelHandler) ValidateTopology(c *gin.Context)
- type KernelNodeOperationsHandler
- type KernelNotificationsHandler
- type KnowledgeHandler
- type LoadBalancerHandler
- func (h *LoadBalancerHandler) CreateLoadBalancer(c *gin.Context)
- func (h *LoadBalancerHandler) DeleteLoadBalancer(c *gin.Context)
- func (h *LoadBalancerHandler) GetLoadBalancer(c *gin.Context)
- func (h *LoadBalancerHandler) GetLoadBalancerStats(c *gin.Context)
- func (h *LoadBalancerHandler) ListLoadBalancers(c *gin.Context)
- func (h *LoadBalancerHandler) RunHealthCheck(c *gin.Context)
- func (h *LoadBalancerHandler) UpdateLoadBalancer(c *gin.Context)
- type MFAHandler
- func (h *MFAHandler) DisableMFA(c *gin.Context)
- func (h *MFAHandler) EnableTOTP(c *gin.Context)
- func (h *MFAHandler) GetAdminConfig(c *gin.Context)
- func (h *MFAHandler) GetStatus(c *gin.Context)
- func (h *MFAHandler) RegenerateBackupCodes(c *gin.Context)
- func (h *MFAHandler) SetupTOTP(c *gin.Context)
- func (h *MFAHandler) UpdateAdminConfig(c *gin.Context)
- func (h *MFAHandler) VerifyMFA(c *gin.Context)
- type MetricsHandler
- type ModuleHandler
- func (h *ModuleHandler) CreateEnrollment(c *gin.Context)
- func (h *ModuleHandler) ListEnrollments(c *gin.Context)
- func (h *ModuleHandler) ListRuntimes(c *gin.Context)
- func (h *ModuleHandler) RevokeEnrollment(c *gin.Context)
- func (h *ModuleHandler) RotateCA(c *gin.Context)
- func (h *ModuleHandler) SetRuntime(c *gin.Context)
- func (h *ModuleHandler) TrustBundle(c *gin.Context)
- type MonitorOverview
- type MonitorSnapshot
- type MonitorWSHandler
- type MonitorWSMessage
- type Node
- type NodeDelta
- type NodeHandler
- func (h *NodeHandler) CreateNode(c *gin.Context)
- func (h *NodeHandler) CreateProtocol(c *gin.Context)
- func (h *NodeHandler) DeleteAuthKey(c *gin.Context)
- func (h *NodeHandler) DeleteNode(c *gin.Context)
- func (h *NodeHandler) DeleteProtocol(c *gin.Context)
- func (h *NodeHandler) DispatchAgentControlOperation(c *gin.Context)
- func (h *NodeHandler) GenerateAuthKey(c *gin.Context)
- func (h *NodeHandler) GenerateWireGuardKeypair(c *gin.Context)
- func (h *NodeHandler) GetAgentControlStatus(c *gin.Context)
- func (h *NodeHandler) GetAuthKeys(c *gin.Context)
- func (h *NodeHandler) GetNode(c *gin.Context)
- func (h *NodeHandler) GetNodeCredentials(c *gin.Context)
- func (h *NodeHandler) GetNodeLogs(c *gin.Context)
- func (h *NodeHandler) GetNodeRawConfig(c *gin.Context)
- func (h *NodeHandler) GetNodeStats(c *gin.Context)
- func (h *NodeHandler) GetNodes(c *gin.Context)
- func (h *NodeHandler) GetProtocolTemplates(c *gin.Context)
- func (h *NodeHandler) GetProtocols(c *gin.Context)
- func (h *NodeHandler) Heartbeat(c *gin.Context)
- func (h *NodeHandler) InternalGenerateAuthKey(c *gin.Context)
- func (h *NodeHandler) Register(c *gin.Context)
- func (h *NodeHandler) RuntimeHealth(c *gin.Context)
- func (h *NodeHandler) SyncProtocol(c *gin.Context)
- func (h *NodeHandler) UpdateNode(c *gin.Context)
- func (h *NodeHandler) UpdateNodeRawConfig(c *gin.Context)
- func (h *NodeHandler) UpdateProtocol(c *gin.Context)
- func (h *NodeHandler) ValidateRawConfig(c *gin.Context)
- type NodeSnapshot
- type NodeTrafficHandler
- type NotificationHandler
- func (h *NotificationHandler) CreateTemplate(c *gin.Context)
- func (h *NotificationHandler) DeleteTemplate(c *gin.Context)
- func (h *NotificationHandler) GetEmailConfig(c *gin.Context)
- func (h *NotificationHandler) GetUnreadCount(c *gin.Context)
- func (h *NotificationHandler) GetUserNotifications(c *gin.Context)
- func (h *NotificationHandler) ListLogs(c *gin.Context)
- func (h *NotificationHandler) ListTemplates(c *gin.Context)
- func (h *NotificationHandler) MarkAllAsRead(c *gin.Context)
- func (h *NotificationHandler) MarkAsRead(c *gin.Context)
- func (h *NotificationHandler) SendTestNotification(c *gin.Context)
- func (h *NotificationHandler) UpdateEmailConfig(c *gin.Context)
- func (h *NotificationHandler) UpdateTemplate(c *gin.Context)
- type NotifySettingsRequest
- type Order
- type OrderHandler
- type PaymentGatewayHandler
- func (h *PaymentGatewayHandler) CreateGateway(c *gin.Context)
- func (h *PaymentGatewayHandler) CreatePayment(c *gin.Context)
- func (h *PaymentGatewayHandler) DeleteGateway(c *gin.Context)
- func (h *PaymentGatewayHandler) GetChannels(c *gin.Context)
- func (h *PaymentGatewayHandler) GetPaymentStats(c *gin.Context)
- func (h *PaymentGatewayHandler) GetPaymentStatus(c *gin.Context)
- func (h *PaymentGatewayHandler) GetUserRecords(c *gin.Context)
- func (h *PaymentGatewayHandler) ListGateways(c *gin.Context)
- func (h *PaymentGatewayHandler) ListPaymentRecords(c *gin.Context)
- func (h *PaymentGatewayHandler) PaymentCallback(c *gin.Context)
- func (h *PaymentGatewayHandler) ToggleGateway(c *gin.Context)
- func (h *PaymentGatewayHandler) UpdateGateway(c *gin.Context)
- type PaymentHandler
- func (h *PaymentHandler) FiatCreatePayment(c *gin.Context)
- func (h *PaymentHandler) GetPaymentMethods(c *gin.Context)
- func (h *PaymentHandler) GetPaymentStatus(c *gin.Context)
- func (h *PaymentHandler) PayPalWebhook(c *gin.Context)
- func (h *PaymentHandler) StripeWebhook(c *gin.Context)
- func (h *PaymentHandler) X402Callback(c *gin.Context)
- func (h *PaymentHandler) X402CheckPayment(c *gin.Context)
- func (h *PaymentHandler) X402CreatePayment(c *gin.Context)
- type PublicConfig
- type PublicRegistrationConfig
- type RouteModeChangeBody
- type RouteModeHandler
- type RouteModeRollbackBody
- type SendNotificationRequest
- type SetWebhookRequest
- type SpeedLimitHandler
- type SubscribeHandler
- type SubscriptionAdminHandler
- func (h *SubscriptionAdminHandler) AssignGroupToPlan(c *gin.Context)
- func (h *SubscriptionAdminHandler) AssignGroupToUser(c *gin.Context)
- func (h *SubscriptionAdminHandler) CreateGroup(c *gin.Context)
- func (h *SubscriptionAdminHandler) CreateTemplate(c *gin.Context)
- func (h *SubscriptionAdminHandler) DeleteGroup(c *gin.Context)
- func (h *SubscriptionAdminHandler) DeleteTemplate(c *gin.Context)
- func (h *SubscriptionAdminHandler) GetAvailableProtocols(c *gin.Context)
- func (h *SubscriptionAdminHandler) GetGroup(c *gin.Context)
- func (h *SubscriptionAdminHandler) GetGroupProtocols(c *gin.Context)
- func (h *SubscriptionAdminHandler) GetGroupStats(c *gin.Context)
- func (h *SubscriptionAdminHandler) GetGroups(c *gin.Context)
- func (h *SubscriptionAdminHandler) GetPlanGroups(c *gin.Context)
- func (h *SubscriptionAdminHandler) GetProtocolTypes(c *gin.Context)
- func (h *SubscriptionAdminHandler) GetSubscriptionFormats(c *gin.Context)
- func (h *SubscriptionAdminHandler) GetTemplate(c *gin.Context)
- func (h *SubscriptionAdminHandler) GetTemplates(c *gin.Context)
- func (h *SubscriptionAdminHandler) GetUserGroups(c *gin.Context)
- func (h *SubscriptionAdminHandler) PreviewSubscription(c *gin.Context)
- func (h *SubscriptionAdminHandler) RemoveGroupFromPlan(c *gin.Context)
- func (h *SubscriptionAdminHandler) RemoveGroupFromUser(c *gin.Context)
- func (h *SubscriptionAdminHandler) UpdateGroup(c *gin.Context)
- func (h *SubscriptionAdminHandler) UpdateGroupProtocols(c *gin.Context)
- func (h *SubscriptionAdminHandler) UpdateTemplate(c *gin.Context)
- type SystemHandler
- func (h *SystemHandler) CreateBackup(c *gin.Context)
- func (h *SystemHandler) DeleteBackup(c *gin.Context)
- func (h *SystemHandler) DeleteConfig(c *gin.Context)
- func (h *SystemHandler) GetAuditLogs(c *gin.Context)
- func (h *SystemHandler) GetBackupConfig(c *gin.Context)
- func (h *SystemHandler) GetBackupStats(c *gin.Context)
- func (h *SystemHandler) GetConfig(c *gin.Context)
- func (h *SystemHandler) GetConfigs(c *gin.Context)
- func (h *SystemHandler) GetSubscriptionSettings(c *gin.Context)
- func (h *SystemHandler) ListBackups(c *gin.Context)
- func (h *SystemHandler) RestoreBackup(c *gin.Context)
- func (h *SystemHandler) SetConfig(c *gin.Context)
- func (h *SystemHandler) UpdateBackupConfig(c *gin.Context)
- type TelegramHandler
- func (h *TelegramHandler) Broadcast(c *gin.Context)
- func (h *TelegramHandler) DeleteWebhook(c *gin.Context)
- func (h *TelegramHandler) GetBot(c *gin.Context)
- func (h *TelegramHandler) GetTelegramStatus(c *gin.Context)
- func (h *TelegramHandler) GetUserBindings(c *gin.Context)
- func (h *TelegramHandler) SendNotification(c *gin.Context)
- func (h *TelegramHandler) SetWebhook(c *gin.Context)
- func (h *TelegramHandler) TelegramWebhook(c *gin.Context)
- func (h *TelegramHandler) UnbindTelegram(c *gin.Context)
- func (h *TelegramHandler) UpdateBot(c *gin.Context)
- func (h *TelegramHandler) UpdateNotifySettings(c *gin.Context)
- func (h *TelegramHandler) UpdateUserNotify(c *gin.Context)
- type TestGostConnectionRequest
- type TicketHandler
- type ToggleRequest
- type UniProxyHandler
- type UpdateBotRequest
- type UpdateGatewayRequest
- type UpdateNodeRequest
- type UpdateRuleRequest
- type User
- type UserActivityEntry
- type UserHandler
- type UserPlanHandler
Constants ¶
const ( DefaultPageSize = 20 MaxPageSize = 100 )
Pagination defaults and limits.
const (
// ForwardV4Prefix is the forward package's v4 API.
ForwardV4Prefix = "/api/v4/forward"
)
const MaxAdminIDs = 200
MaxAdminIDs is the most ids one administrator request names: the activity lookup's ids and a bulk action's ids.
Variables ¶
var ( BuildVersion = "dev" BuildTime = "unknown" BuildCode = "" BuildCommit = "unknown" )
BuildInfo is set via ldflags at build time.
var ReleaseVersion = branding.DefaultVersion
ReleaseVersion is the running Control's version (set at startup from the build); the Agent it installs carries the same number (H25).
Functions ¶
func AdminMFASettings ¶ added in v4.1.0
AdminMFASettings returns the admin MFA configuration as the admin API shows it, with defaults applied; KernelIdentity seeds identity with it.
func ClampPagination ¶
ClampPagination ensures page >= 1 and pageSize is within [1, MaxPageSize]. It returns the clamped values, using DefaultPageSize when pageSize is zero.
func FinalizeIdentity ¶ added in v4.1.0
FinalizeIdentity removes the legacy credentials. It cannot be undone.
func IdentityJWKS ¶ added in v4.1.0
IdentityJWKS publishes the identity module's token keys that Control accepts, so other services can verify identity tokens issued for Control.
func IdentityLogout ¶ added in v4.1.0
IdentityLogout ends the calling session: its token stops working at once, in every Control process, until it would have expired anyway. Tokens issued before session ids existed carry none and cannot be ended alone.
func IdentityStatus ¶ added in v4.1.0
IdentityStatus reports the identity authority state and the account import progress.
func LoadNotificationEmailConfig ¶ added in v4.2.0
func LoadNotificationEmailConfig(db *gorm.DB) (*model.EmailConfig, error)
LoadNotificationEmailConfig reads the administrators' e-mail settings (the notification e-mail configuration) for senders outside a request, such as the alert monitor's digest. A configuration without a host or a from address is not usable: it answers nil.
func NewV2CompatibilityGateway ¶
func NewV2CompatibilityGateway(cfg *config.Config, cache *compatv2.VerifiedRouteCache) *compatv2.Gateway
NewV2CompatibilityGateway builds the unary v2 compatibility gateway. A missing or invalid trust root remains a resolver error, so the gateway fails closed rather than using legacy code.
func NewV2RouteCache ¶ added in v4.1.0
func NewV2RouteCache() *compatv2.VerifiedRouteCache
NewV2RouteCache returns the verified-route cache that one router's unary and WebSocket v2 gateways share, so a signed release artifact is verified once rather than per request and per gateway.
func NewV2WebSocketGateway ¶
func NewV2WebSocketGateway(cfg *config.Config, cache *compatv2.VerifiedRouteCache) *compatv2.WebSocketGateway
NewV2WebSocketGateway exposes the optional streaming capability only when the current manager explicitly implements it.
func PublicConfigHandler ¶ added in v4.1.0
func PublicConfigHandler(cfg *config.Config) gin.HandlerFunc
PublicConfigHandler serves GET /api/v4/public/config.
@Summary 公开配置 @Description 产品版本 (community / commercial)、该版本隐藏的包,以及注册是否需要邀请码 @Tags 系统 @Produce json @Success 200 {object} map[string]interface{} @Router /api/v4/public/config [get]
func StartIdentityCutover ¶ added in v4.1.0
StartIdentityCutover hands group A to identity in the background; IdentityStatus follows it.
func StartIdentityImport ¶ added in v4.1.0
StartIdentityImport starts a full or delta account import in the background; IdentityStatus follows it.
func StartIdentityRollback ¶ added in v4.1.0
StartIdentityRollback hands group A back to the legacy handlers (before finalize) in the background; IdentityStatus follows it.
Types ¶
type AdminAPITokensHandler ¶ added in v4.2.0
type AdminAPITokensHandler struct {
// contains filtered or unexported fields
}
AdminAPITokensHandler manages administrators' personal access tokens (docs/reference/admin-api-tokens.md). Its routes need a signed-in session: the authentication middleware refuses every API token on them, so a stolen token cannot mint, list or end tokens.
func NewAdminAPITokensHandler ¶ added in v4.2.0
func NewAdminAPITokensHandler() *AdminAPITokensHandler
NewAdminAPITokensHandler returns the handler over the process database.
func (*AdminAPITokensHandler) Create ¶ added in v4.2.0
func (h *AdminAPITokensHandler) Create(c *gin.Context)
Create godoc @Summary Create an admin API token @Description Issues a personal access token for automation: `anixadm_` and 43 characters, shown once in this answer; only its SHA-256 is stored. Scope `read` allows GET and HEAD on the administrator APIs except the reads that answer a secret in clear; `admin` allows what the owner may do except managing tokens. Needs a signed-in session (never an API token) and a re-authentication: the current password, or a TOTP or recovery code when the account has a second factor (when the kernel cannot check a credential because identity holds it, the sign-in must be at most 10 minutes old, or it answers 403 step_up_sign_in_stale). Up to 25 active tokens per administrator; the owner's rights are read on every use. Audited. Send the token as `Authorization: Bearer <token>` only, never in a URL. @Tags Kernel @Accept json @Produce json @Security BearerAuth @Param request body createAdminAPITokenRequest true "name, scope (read or admin), optional expires_in_days, and password or code (+ method)" @Success 201 {object} map[string]any "data.token is shown once; data.api_token is the stored record" @Router /api/v4/kernel/api-tokens [post]
func (*AdminAPITokensHandler) List ¶ added in v4.2.0
func (h *AdminAPITokensHandler) List(c *gin.Context)
List godoc @Summary List admin API tokens @Description Lists the caller's active API tokens (add include_inactive=true for revoked and expired ones): id, name, scope, last four characters, expiry, last use. Never a secret. A super administrator may list another administrator's tokens with user_id, or everyone's with all=true. Needs a signed-in session. @Tags Kernel @Produce json @Security BearerAuth @Param user_id query int false "another administrator (super administrators only)" @Param all query bool false "every administrator's tokens (super administrators only)" @Param include_inactive query bool false "also revoked and expired tokens" @Success 200 {object} map[string]any @Router /api/v4/kernel/api-tokens [get]
func (*AdminAPITokensHandler) Revoke ¶ added in v4.2.0
func (h *AdminAPITokensHandler) Revoke(c *gin.Context)
Revoke godoc @Summary Revoke an admin API token @Description Ends a token at once. An administrator revokes their own tokens; a super administrator revokes anyone's (for example a departed administrator's). Revoking a revoked token is not an error. Needs a signed-in session. Audited. @Tags Kernel @Produce json @Security BearerAuth @Param id path string true "token id" @Success 200 {object} map[string]any @Router /api/v4/kernel/api-tokens/{id} [delete]
type AdminBulkHandler ¶ added in v4.2.0
type AdminBulkHandler struct {
// contains filtered or unexported fields
}
AdminBulkHandler serves the bulk endpoints of the console's tables.
func NewAdminBulkHandler ¶ added in v4.2.0
func NewAdminBulkHandler(run BulkRunner) *AdminBulkHandler
NewAdminBulkHandler returns the handler with the runner that performs each item.
func (*AdminBulkHandler) InviteCodes ¶ added in v4.2.0
func (h *AdminBulkHandler) InviteCodes(c *gin.Context)
InviteCodes godoc @Summary 批量操作邀请码 @Description 对 ids 中的每个邀请码逐个执行单个接口 (撤销 DELETE /admin/invite/codes/{id}), 语义同批量用户操作: ids 最多 200 个, 每个 id 独立生效, 总是 HTTP 200 并返回逐个结果。已使用的邀请码保留并报告 conflict, 已撤销或不存在的报告 not_found (重试一次部分成功的批量时, 已撤销的会报 not_found)。 @Tags admin-invite-codes @Accept json @Produce json @Security BearerAuth @Param request body object true "{action: revoke, ids: [邀请码ID...]}" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /api/v4/admin/invite-codes/bulk [post]
func (*AdminBulkHandler) Users ¶ added in v4.2.0
func (h *AdminBulkHandler) Users(c *gin.Context)
Users godoc @Summary 批量操作用户 @Description 对 ids 中的每个用户逐个执行单用户接口 (封禁 POST /admin/users/{id}/ban, 解封 .../unban, 重置流量 .../reset-traffic), 经同一个 /api/v2 网关, 所以与单个请求走同一套处理和路由模式。ids 最多 200 个, 去重后按请求顺序处理。不是全有或全无: 每个 id 独立生效、独立失败, 总是 HTTP 200 并返回逐个结果 {id, ok, error{code, message}} (请求本身无效才是 400)。封禁与解封可重复执行 (已处于目标状态也算成功); 重置流量在请求带 Idempotency-Key 时重试只生效一次。管理员不能在批量中封禁自己 (forbidden_self)。请求按 bulk_<action> 记入审计日志, 每个 id 另记一条与单个请求相同的审计记录。不提供删除用户与重置订阅链接。 @Tags 管理端-用户 @Accept json @Produce json @Security BearerAuth @Param Idempotency-Key header string false "重试同一批量请求时使用同一个键" @Param request body object true "{action: ban|unban|reset_traffic, ids: [用户ID...]}" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /api/v4/admin/users/bulk [post]
type AdminCouponHandler ¶
type AdminCouponHandler struct{}
AdminCouponHandler 优惠券处理器
func NewAdminCouponHandler ¶
func NewAdminCouponHandler() *AdminCouponHandler
NewAdminCouponHandler 创建优惠券处理器
func (*AdminCouponHandler) CreateCoupon ¶
func (h *AdminCouponHandler) CreateCoupon(c *gin.Context)
CreateCoupon 创建优惠券
func (*AdminCouponHandler) DeleteCoupon ¶
func (h *AdminCouponHandler) DeleteCoupon(c *gin.Context)
DeleteCoupon 删除优惠券
func (*AdminCouponHandler) GetCoupons ¶
func (h *AdminCouponHandler) GetCoupons(c *gin.Context)
GetCoupons 获取优惠券列表
type AdminGroupMembersHandler ¶ added in v4.2.0
type AdminGroupMembersHandler struct {
// contains filtered or unexported fields
}
AdminGroupMembersHandler lists the users of a subscription group.
func NewAdminGroupMembersHandler ¶ added in v4.2.0
func NewAdminGroupMembersHandler() *AdminGroupMembersHandler
NewAdminGroupMembersHandler reads the kernel database.
func (*AdminGroupMembersHandler) List ¶ added in v4.2.0
func (h *AdminGroupMembersHandler) List(c *gin.Context)
List godoc @Summary 订阅分组成员 @Description 分页列出被直接授予该订阅分组的用户 (v2_user_subscription_group), 与分组统计的 user_count / enabled_users 同口径; 通过套餐或主分组到达该分组的用户不在其中。按授予时间倒序。不含订阅 token 与 uuid。 @Tags 管理端-订阅 @Produce json @Security BearerAuth @Param id path int true "订阅分组 ID" @Param page query int false "页码" default(1) @Param page_size query int false "每页数量 (最多 100)" default(20) @Param q query string false "邮箱包含" @Param status query string false "成员资格: active (未过期) 或 expired" Enums(active, expired) @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Router /api/v4/admin/subscription-groups/{id}/members [get]
type AdminHandler ¶
type AdminHandler struct {
// contains filtered or unexported fields
}
AdminHandler 管理员处理器
func (*AdminHandler) AssignPlanToUser ¶
func (h *AdminHandler) AssignPlanToUser(c *gin.Context)
AssignPlanToUser godoc @Summary 分配套餐给用户 @Description 管理员将指定套餐分配给用户 @Tags 管理端-套餐 @Accept json @Produce json @Security BearerAuth @Param id path int true "套餐ID" @Param request body map[string]any true "分配请求 {user_id: uint, expire_at: int64}" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/plans/{id}/assign [post]
func (*AdminHandler) BanUser ¶
func (h *AdminHandler) BanUser(c *gin.Context)
BanUser godoc @Summary 封禁用户 @Description 管理员封禁指定用户 @Tags 管理端-用户 @Accept json @Produce json @Security BearerAuth @Param id path int true "用户ID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/users/{id}/ban [post]
func (*AdminHandler) CancelOrder ¶
func (h *AdminHandler) CancelOrder(c *gin.Context)
CancelOrder godoc @Summary 取消订单 @Description 管理员取消指定订单 @Tags 管理端-订单 @Accept json @Produce json @Security BearerAuth @Param id path int true "订单ID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/orders/{id}/cancel [post]
func (*AdminHandler) CreatePlan ¶
func (h *AdminHandler) CreatePlan(c *gin.Context)
CreatePlan godoc @Summary 创建套餐 @Description 管理员创建新套餐 @Tags 管理端-套餐 @Accept json @Produce json @Security BearerAuth @Param request body model.Plan true "套餐信息" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/plans [post]
func (*AdminHandler) CreateUser ¶
func (h *AdminHandler) CreateUser(c *gin.Context)
CreateUser godoc @Summary 创建用户 @Description 管理员创建新用户 @Tags 管理端-用户 @Accept json @Produce json @Security BearerAuth @Param request body model.AdminCreateUserRequest true "用户信息" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /admin/users [post]
func (*AdminHandler) DeletePlan ¶
func (h *AdminHandler) DeletePlan(c *gin.Context)
DeletePlan godoc @Summary 删除套餐 @Description 管理员删除指定套餐 @Tags 管理端-套餐 @Accept json @Produce json @Security BearerAuth @Param id path int true "套餐ID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/plans/{id} [delete]
func (*AdminHandler) DeleteUser ¶
func (h *AdminHandler) DeleteUser(c *gin.Context)
DeleteUser godoc @Summary 删除用户 @Description 管理员删除指定用户 @Tags 管理端-用户 @Accept json @Produce json @Security BearerAuth @Param id path int true "用户ID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/users/{id} [delete]
func (*AdminHandler) GetDashboard ¶
func (h *AdminHandler) GetDashboard(c *gin.Context)
GetDashboard godoc @Summary 获取仪表盘数据 @Description 管理员获取仪表盘统计数据,包括用户数、订单数、收入等 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Param refresh query bool false "是否强制刷新缓存" @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/dashboard [get]
func (*AdminHandler) GetHourlyTraffic ¶
func (h *AdminHandler) GetHourlyTraffic(c *gin.Context)
GetHourlyTraffic 返回最近 N 小时的流量序列 (默认 24 小时, 最多 720 小时) GET /api/v2/admin/traffic/hourly?hours=24&user_id=0
func (*AdminHandler) GetOrder ¶
func (h *AdminHandler) GetOrder(c *gin.Context)
GetOrder godoc The order with its plan's id and name and its buyer's id and e-mail (service.OrderView). @Summary 获取订单详情 @Description 管理员获取指定订单的详细信息 @Tags 管理端-订单 @Accept json @Produce json @Security BearerAuth @Param id path int true "订单ID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Router /admin/orders/{id} [get]
func (*AdminHandler) GetOrderList ¶
func (h *AdminHandler) GetOrderList(c *gin.Context)
GetOrderList godoc Each order carries its plan's id and name and its buyer's id and e-mail (service.OrderView), never the rest of their rows. @Summary 获取订单列表 @Description 管理员获取订单列表,支持分页和筛选 @Tags 管理端-订单 @Accept json @Produce json @Security BearerAuth @Param page query int false "页码" default(1) @Param page_size query int false "每页数量" default(20) @Param trade_no query string false "订单号" @Param email query string false "用户邮箱" @Param status query int false "订单状态" @Param type query int false "订单类型" @Param user_id query int false "用户ID" @Param sort query string false "排序字段: id, trade_no, status, type, total_amount, created_at, paid_at; 缺省为 created_at 倒序" Enums(id, trade_no, status, type, total_amount, created_at, paid_at) @Param order query string false "排序方向, 仅与 sort 同用" Enums(asc, desc) default(asc) @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/orders [get]
func (*AdminHandler) GetOrderStats ¶
func (h *AdminHandler) GetOrderStats(c *gin.Context)
GetOrderStats godoc @Summary 获取订单统计 @Description 管理员获取订单统计数据 @Tags 管理端-订单 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/orders/stats [get]
func (*AdminHandler) GetPlan ¶
func (h *AdminHandler) GetPlan(c *gin.Context)
GetPlan godoc @Summary 获取套餐详情 @Description 管理员获取指定套餐的详细信息 @Tags 管理端-套餐 @Accept json @Produce json @Security BearerAuth @Param id path int true "套餐ID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Router /admin/plans/{id} [get]
func (*AdminHandler) GetPlans ¶
func (h *AdminHandler) GetPlans(c *gin.Context)
GetPlans godoc @Summary 获取套餐列表 @Description 管理员获取所有套餐列表 @Tags 管理端-套餐 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/plans [get]
func (*AdminHandler) GetSystemInfo ¶
func (h *AdminHandler) GetSystemInfo(c *gin.Context)
GET /api/v2/admin/system/info
func (*AdminHandler) GetUser ¶
func (h *AdminHandler) GetUser(c *gin.Context)
GetUser godoc @Summary 获取用户详情 @Description 管理员获取用户详细信息 @Tags 管理端-用户 @Accept json @Produce json @Security BearerAuth @Param id path int true "用户ID" @Success 200 {object} map[string]any @Router /admin/users/{id} [get]
func (*AdminHandler) GetUserList ¶
func (h *AdminHandler) GetUserList(c *gin.Context)
GetUserList godoc Each user carries the account and subscription summary (service.UserListItem), never the subscription token or proxy uuid, which the user detail answers for one user. @Summary 获取用户列表 @Description 管理员获取用户列表 @Tags 管理端-用户 @Accept json @Produce json @Security BearerAuth @Param page query int false "页码" default(1) @Param page_size query int false "每页数量" default(20) @Param email query string false "邮箱搜索" @Param status query string false "状态筛选" @Param plan_id query int false "套餐ID筛选" @Param sort query string false "排序字段: id, email, created_at, expired_at, traffic, transfer_enable; 缺省为 created_at 倒序" Enums(id, email, created_at, expired_at, traffic, transfer_enable) @Param order query string false "排序方向, 仅与 sort 同用" Enums(asc, desc) default(asc) @Success 200 {object} map[string]any @Router /admin/users [get]
func (*AdminHandler) GetUserStats ¶
func (h *AdminHandler) GetUserStats(c *gin.Context)
GetUserStats godoc @Summary 获取用户统计 @Description 管理员获取用户统计数据,包括总用户数、活跃用户等 @Tags 管理端-用户 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/users/stats [get]
func (*AdminHandler) GetUserTrafficRanking ¶
func (h *AdminHandler) GetUserTrafficRanking(c *gin.Context)
GetUserTrafficRanking 返回最近 N 小时内按用户聚合的流量排行 (默认 24 小时, top 20) GET /api/v2/admin/traffic/user-ranking?hours=24&limit=20
func (*AdminHandler) MarkOrderPaid ¶
func (h *AdminHandler) MarkOrderPaid(c *gin.Context)
MarkOrderPaid godoc @Summary 标记订单已支付 @Description 管理员手动标记订单为已支付并开通服务 @Tags 管理端-订单 @Accept json @Produce json @Security BearerAuth @Param id path int true "订单ID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/orders/{id}/paid [post]
func (*AdminHandler) ResetCompatFlow ¶
func (h *AdminHandler) ResetCompatFlow(c *gin.Context)
ResetCompatFlow is the Flux-style POST /api/v2/user/reset: type 1 zeroes a subscriber's traffic, under service.ForwardUserResetRequestID in the subscriber request ledger so that a retry applies once whichever side serves it (the forward package serves the route natively too); type 2 zeroes a tunnel permission's traffic and that of its forwards.
func (*AdminHandler) ResetUserSubscribe ¶
func (h *AdminHandler) ResetUserSubscribe(c *gin.Context)
ResetUserSubscribe godoc @Summary 重置用户订阅 @Description 管理员为用户重新生成订阅 token, 旧订阅链接立即失效 (UUID 不变) @Tags 管理端-用户 @Accept json @Produce json @Security BearerAuth @Param id path int true "用户ID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/users/{id}/reset-subscribe [post]
func (*AdminHandler) ResetUserTraffic ¶
func (h *AdminHandler) ResetUserTraffic(c *gin.Context)
ResetUserTraffic godoc @Summary 重置用户流量 @Description 管理员重置指定用户的已使用流量 @Tags 管理端-用户 @Accept json @Produce json @Security BearerAuth @Param id path int true "用户ID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/users/{id}/reset-traffic [post]
func (*AdminHandler) UnbanUser ¶
func (h *AdminHandler) UnbanUser(c *gin.Context)
UnbanUser godoc @Summary 解封用户 @Description 管理员解封指定用户 @Tags 管理端-用户 @Accept json @Produce json @Security BearerAuth @Param id path int true "用户ID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/users/{id}/unban [post]
func (*AdminHandler) UpdateOrderStatus ¶
func (h *AdminHandler) UpdateOrderStatus(c *gin.Context)
UpdateOrderStatus godoc @Summary 更新订单状态 @Description 管理员更新指定订单的状态 @Tags 管理端-订单 @Accept json @Produce json @Security BearerAuth @Param id path int true "订单ID" @Param request body map[string]any true "状态请求 {status: int}" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/orders/{id}/status [put]
func (*AdminHandler) UpdatePlan ¶
func (h *AdminHandler) UpdatePlan(c *gin.Context)
UpdatePlan godoc @Summary 更新套餐 @Description 管理员更新指定套餐信息 @Tags 管理端-套餐 @Accept json @Produce json @Security BearerAuth @Param id path int true "套餐ID" @Param request body model.Plan true "套餐信息" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/plans/{id} [put]
func (*AdminHandler) UpdateUser ¶
func (h *AdminHandler) UpdateUser(c *gin.Context)
UpdateUser godoc @Summary 更新用户信息 @Description 管理员更新用户信息,支持修改邮箱、密码、余额、套餐等 @Tags 管理端-用户 @Accept json @Produce json @Security BearerAuth @Param id path int true "用户ID" @Param request body map[string]any true "用户更新信息" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/users/{id} [put]
type AdminKnowledgeHandler ¶
type AdminKnowledgeHandler struct{}
AdminKnowledgeHandler 知识库处理器
func NewAdminKnowledgeHandler ¶
func NewAdminKnowledgeHandler() *AdminKnowledgeHandler
NewAdminKnowledgeHandler 创建知识库处理器
func (*AdminKnowledgeHandler) CreateArticle ¶
func (h *AdminKnowledgeHandler) CreateArticle(c *gin.Context)
CreateArticle 创建文章
func (*AdminKnowledgeHandler) DeleteArticle ¶
func (h *AdminKnowledgeHandler) DeleteArticle(c *gin.Context)
DeleteArticle 删除文章
func (*AdminKnowledgeHandler) GetArticles ¶
func (h *AdminKnowledgeHandler) GetArticles(c *gin.Context)
GetArticles 获取文章列表
func (*AdminKnowledgeHandler) UpdateArticle ¶
func (h *AdminKnowledgeHandler) UpdateArticle(c *gin.Context)
UpdateArticle 更新文章
type AdminTicketHandler ¶
type AdminTicketHandler struct{}
AdminTicketHandler 工单处理器
func NewAdminTicketHandler ¶
func NewAdminTicketHandler() *AdminTicketHandler
NewAdminTicketHandler 创建工单处理器
func (*AdminTicketHandler) CloseTicket ¶
func (h *AdminTicketHandler) CloseTicket(c *gin.Context)
CloseTicket 关闭工单
func (*AdminTicketHandler) GetTickets ¶
func (h *AdminTicketHandler) GetTickets(c *gin.Context)
GetTickets 获取工单列表
func (*AdminTicketHandler) ReplyTicket ¶
func (h *AdminTicketHandler) ReplyTicket(c *gin.Context)
ReplyTicket 回复工单
type AdminUserActivityHandler ¶ added in v4.2.0
type AdminUserActivityHandler struct {
// contains filtered or unexported fields
}
AdminUserActivityHandler answers when users were last seen online.
func NewAdminUserActivityHandler ¶ added in v4.2.0
func NewAdminUserActivityHandler() *AdminUserActivityHandler
NewAdminUserActivityHandler reads the kernel database.
func (*AdminUserActivityHandler) List ¶ added in v4.2.0
func (h *AdminUserActivityHandler) List(c *gin.Context)
List godoc @Summary 用户最近在线时间 @Description 按 ids 返回用户最近一次在线的 Unix 时间 (秒)。在线指节点上报了该用户的流量或在线连接, 时间滞后上报不超过一分钟; 从未在线的用户 last_online_at 为 null。ids 最多 200 个, 按请求顺序去重返回。 @Tags 管理端-用户 @Produce json @Security BearerAuth @Param ids query string true "用户 ID, 逗号分隔, 最多 200 个" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /api/v4/admin/users/activity [get]
type AgentConnection ¶
type AgentConnection struct {
NodeID uint
LastSeen time.Time
Version string
SystemInfo map[string]any
Capabilities []string
IsForwardNode bool
WsConn *websocket.Conn
// contains filtered or unexported fields
}
AgentConnection Agent 连接信息
type AgentHandler ¶
type AgentHandler struct {
// contains filtered or unexported fields
}
AgentHandler Agent 管理 API
func (*AgentHandler) AgentGetForwardRules ¶
func (h *AgentHandler) AgentGetForwardRules(c *gin.Context)
AgentGetForwardRules godoc @Summary 获取转发规则 @Description Agent 获取该节点的转发规则 @Tags Agent @Produce json @Param node_id query int true "节点 ID" @Param X-API-Key header string true "forward node API token" @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 403 {object} map[string]any @Router /api/v2/forward/agent/rules [get]
Only a forward node reads its rules: the request names the node (node_id, or the X-Node-ID header) and carries its API token (the X-API-Key header, or api_key or token), as the agent's other calls do. The route is public, and the rules show where every user's traffic goes.
func (*AgentHandler) AgentGetTasks ¶
func (h *AgentHandler) AgentGetTasks(c *gin.Context)
AgentGetTasks godoc @Summary 获取待执行任务 @Description Agent 轮询获取待执行的任务 @Tags Agent @Produce json @Param node_id query int true "节点 ID" @Success 200 {object} map[string]any @Router /api/v2/agent/tasks [get]
func (*AgentHandler) AgentHeartbeat ¶
func (h *AgentHandler) AgentHeartbeat(c *gin.Context)
AgentHeartbeat godoc @Summary Agent 心跳 @Description Agent 定期发送心跳 @Tags Agent @Accept json @Produce json @Param request body AgentHeartbeatRequest true "心跳信息" @Success 200 {object} map[string]any @Router /api/v2/agent/heartbeat [post]
func (*AgentHandler) AgentMonitor ¶
func (h *AgentHandler) AgentMonitor(c *gin.Context)
AgentMonitor godoc @Summary 上报监控数据 @Description Agent 上报系统监控数据 @Tags Agent @Accept json @Produce json @Param request body AgentMonitorRequest true "监控数据" @Success 200 {object} map[string]any @Router /api/v2/agent/monitor [post]
func (*AgentHandler) AgentRegister ¶
func (h *AgentHandler) AgentRegister(c *gin.Context)
AgentRegister godoc @Summary Agent 注册 @Description Agent 启动时注册到面板 @Tags Agent @Accept json @Produce json @Param request body AgentRegisterRequest true "注册信息" @Success 200 {object} map[string]any @Router /api/v2/agent/register [post]
func (*AgentHandler) AgentReportResult ¶
func (h *AgentHandler) AgentReportResult(c *gin.Context)
AgentReportResult godoc @Summary 上报任务结果 @Description Agent 上报任务执行结果 @Tags Agent @Accept json @Produce json @Param request body AgentTaskResult true "任务结果" @Success 200 {object} map[string]any @Router /api/v2/agent/result [post]
func (*AgentHandler) AgentWebSocketUnified ¶
func (h *AgentHandler) AgentWebSocketUnified(c *gin.Context)
AgentWebSocketUnified supports both legacy message-auth and header/query-auth. @Summary WebSocket 连接 @Description Agent 建立 WebSocket 长连接 @Tags Agent @Success 101 @Router /api/v2/agent/ws [get]
func (*AgentHandler) CreateTask ¶
func (h *AgentHandler) CreateTask(c *gin.Context)
CreateTask godoc @Summary 创建任务 @Description 管理员向节点下发任务 @Tags 管理端 Agent @Accept json @Produce json @Security BearerAuth @Param request body CreateTaskRequest true "任务信息" @Success 200 {object} map[string]any @Router /admin/agent/tasks [post]
func (*AgentHandler) ExecuteCommand ¶
func (h *AgentHandler) ExecuteCommand(c *gin.Context)
ExecuteCommand godoc @Summary 执行命令 @Description 管理员在节点上执行命令 @Tags 管理端 Agent @Accept json @Produce json @Security BearerAuth @Param request body ExecuteCommandRequest true "命令信息" @Success 200 {object} map[string]any @Router /admin/agent/execute [post]
func (*AgentHandler) GetMonitor ¶
func (h *AgentHandler) GetMonitor(c *gin.Context)
GetMonitor godoc @Summary Get latest monitor payload from agent node @Description Query monitor data by node_id @Tags 管理端 Agent @Produce json @Security BearerAuth @Param node_id query int true "Node ID" @Success 200 {object} map[string]any @Failure 404 {object} map[string]any @Router /admin/agent/monitor [get]
func (*AgentHandler) GetTaskResult ¶
func (h *AgentHandler) GetTaskResult(c *gin.Context)
GetTaskResult godoc @Summary Get task execution result @Description Query the latest status/result for a task by task_id @Tags 管理端 Agent @Produce json @Security BearerAuth @Param task_id path string true "Task ID" @Success 200 {object} map[string]any @Failure 404 {object} map[string]any @Router /admin/agent/tasks/{task_id} [get]
func (*AgentHandler) ListAgents ¶
func (h *AgentHandler) ListAgents(c *gin.Context)
ListAgents godoc @Summary 获取在线 Agent 列表 @Description 管理员获取所有在线的 Agent @Tags 管理端 Agent @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Router /admin/agent/list [get]
func (*AgentHandler) ListDiagnosticTasks ¶
func (h *AgentHandler) ListDiagnosticTasks(c *gin.Context)
ListDiagnosticTasks godoc @Summary List diagnostic task history @Description Query recent whitelisted diagnostic tasks, optionally filtered by node_id @Tags 管理端 Agent @Produce json @Security BearerAuth @Param node_id query int false "Node ID" @Param limit query int false "Limit" @Success 200 {object} map[string]any @Router /admin/agent/tasks [get]
func (*AgentHandler) PrepareWebSocketBridge ¶
func (h *AgentHandler) PrepareWebSocketBridge(c *gin.Context) bool
PrepareWebSocketBridge authenticates optional request credentials before a package-host relay is opened. It retains only the verified node identity in Gin context; the credential itself never reaches the package host.
func (*AgentHandler) RequireAgentNode ¶ added in v4.1.0
func (h *AgentHandler) RequireAgentNode(c *gin.Context)
RequireAgentNode authenticates an agent's HTTP request in the kernel, before the package gateway, as the agent WebSocket's preflight does: the node id comes from X-Node-ID or the node_id query, the token from X-API-Key or the api_key or token query, and verifyForwardNodeToken checks it. The verified node travels to the legacy handler as the kernel's trusted agent identity, so the credential never reaches the package host.
The heartbeat, task, result and monitor routes had no authentication: anyone could mark any node online, take and complete its queued tasks (forward runtime jobs included) or report its monitoring data.
func (*AgentHandler) WebSockets ¶ added in v4.1.0
func (h *AgentHandler) WebSockets() agentstreams.WebSockets
WebSockets is this handler's connected agents as the KernelNodeOps session RPCs and the agent.diagnostic executor read them (agentstreams.WebSockets).
type AgentHeartbeatRequest ¶
type AgentHeartbeatRequest struct {
NodeID uint `json:"node_id" binding:"required,gt=0"`
Status string `json:"status" binding:"omitempty,max=32"`
Resources map[string]any `json:"resources"`
}
AgentHeartbeatRequest 心跳请求
type AgentInstallHandler ¶ added in v4.2.0
type AgentInstallHandler struct {
// contains filtered or unexported fields
}
AgentInstallHandler is one-command node onboarding (forward-sdk.md, section 9): install tokens for the node page and the public install script, its signature, the release metadata and the Agent release.
func NewAgentInstallHandler ¶ added in v4.2.0
func NewAgentInstallHandler() *AgentInstallHandler
NewAgentInstallHandler reads the loaded configuration and database on each request.
func (*AgentInstallHandler) Artifact ¶ added in v4.2.0
func (h *AgentInstallHandler) Artifact(c *gin.Context)
Artifact serves an Agent release asset from agent_install.artifact_dir (the control mirror).
func (*AgentInstallHandler) CreateInstallToken ¶ added in v4.2.0
func (h *AgentInstallHandler) CreateInstallToken(c *gin.Context)
CreateInstallToken issues a single-use enrollment token bound to a node and returns the install command for every mirror. Super administrators only; agentpki writes the token's audit entry.
func (*AgentInstallHandler) Metadata ¶ added in v4.2.0
func (h *AgentInstallHandler) Metadata(c *gin.Context)
Metadata serves /install/agent.env: the Agent release, the gRPC target, the mirrors and, when Control holds the release, its digests.
func (*AgentInstallHandler) Script ¶ added in v4.2.0
func (h *AgentInstallHandler) Script(c *gin.Context)
Script serves the install script, byte for byte the signed release asset.
func (*AgentInstallHandler) Signature ¶ added in v4.2.0
func (h *AgentInstallHandler) Signature(c *gin.Context)
Signature serves the script's release signature once it verifies with the official key: a stale or foreign file is never served.
type AgentMonitorRequest ¶
type AgentMonitorRequest struct {
NodeID uint `json:"node_id" binding:"required"`
System map[string]any `json:"system"`
}
AgentMonitorRequest 监控请求
type AgentMonitorSnapshot ¶
type AgentMonitorSnapshot struct {
NodeID uint `json:"node_id"`
System map[string]any `json:"system"`
UpdatedAt time.Time `json:"updated_at"`
}
AgentMonitorSnapshot stores the latest monitor payload pushed by an agent node.
type AgentPKIHandler ¶ added in v4.1.0
type AgentPKIHandler struct {
// contains filtered or unexported fields
}
AgentPKIHandler administers agent enrollment: one-time credentials that enroll a new node's agent (node-ops-service.md, section 5.3). Routes sit behind admin authentication and the audit log.
func NewAgentPKIHandler ¶ added in v4.1.0
func NewAgentPKIHandler() *AgentPKIHandler
NewAgentPKIHandler builds the agent PKI from the loaded configuration on each request.
func (*AgentPKIHandler) CreateEnrollmentToken ¶ added in v4.1.0
func (h *AgentPKIHandler) CreateEnrollmentToken(c *gin.Context)
CreateEnrollmentToken issues a one-time agent enrollment credential bound to a node.
func (*AgentPKIHandler) RotateCredentials ¶ added in v4.2.0
func (h *AgentPKIHandler) RotateCredentials(c *gin.Context)
RotateCredentials rotates a node's Agent credentials: it revokes the node's Agent certificates and enrollments, optionally replaces a proxy node's API key, and issues a fresh one-time enrollment credential so the Agent enrolls again. Super administrators only; the audit entries are written by agentpki (this route is outside the AuditLog middleware).
RotateCredentials godoc @Summary Rotate a node's Agent credentials @Description Revokes every Agent certificate, enrollment (unused enrollment credentials included) and forward link certificate of the node, optionally replaces a proxy node's API key (rotate_api_key; the new key is read through the audited GET /api/v2/admin/nodes/{id}/credentials), and returns a fresh one-time anixagt_ enrollment credential, shown once, for the Agent to enroll again (install script with --reset). Never dials the node, so it works while the node is offline; open Agent streams end at their next heartbeat. Repeating it leaves exactly one valid enrollment credential, the last. Super administrators only. Audited as agent_credentials_rotate and agent_enrollment_token_issue. @Tags Kernel @Accept json @Produce json @Security BearerAuth @Param request body rotateAgentCredentialsRequest true "node (proxy-<id> or forward-<id>), rotate_api_key (proxy nodes only, default false), ttl_seconds (60 to 604800, default 3600), reason (at most 200 bytes, UTF-8)" @Success 201 {object} map[string]any "data.credential is shown once" @Failure 400 {object} map[string]any @Failure 403 {object} map[string]any @Failure 404 {object} map[string]any @Failure 409 {object} map[string]any @Router /api/v4/kernel/agents/rotate-credentials [post]
type AgentRegisterRequest ¶
type AgentRegisterRequest struct {
NodeID uint `json:"node_id" binding:"required,gt=0"`
Token string `json:"token" binding:"required,min=1"`
Version string `json:"version" binding:"omitempty,max=64"`
System map[string]any `json:"system"`
Capabilities []string `json:"capabilities"`
}
AgentRegisterRequest 注册请求
type AgentTaskResult ¶
type AgentTaskResult struct {
TaskID string `json:"task_id" binding:"required"`
NodeID uint `json:"node_id,omitempty"`
Type string `json:"type,omitempty"`
Action string `json:"action,omitempty"`
Success bool `json:"success"`
Output string `json:"output"`
Error string `json:"error,omitempty"`
Data any `json:"data,omitempty"`
Duration int64 `json:"duration_ms"`
Timestamp time.Time `json:"timestamp"`
}
AgentTaskResult 任务结果
type AgentTransportsHandler ¶ added in v4.1.0
type AgentTransportsHandler struct {
// contains filtered or unexported fields
}
AgentTransportsHandler serves the agent transport inventory (node-ops-service.md, section 5.6): which channel each node's agent was last seen on, and whether agent_control.mtls: required (the default from v4.2) would refuse an enabled node.
func NewAgentTransportsHandler ¶ added in v4.1.0
func NewAgentTransportsHandler(policy agenttransport.Policy) *AgentTransportsHandler
NewAgentTransportsHandler reads the kernel database, this process's live sightings and its live Agent Control stream sessions under policy, the router's agent_control.
func (*AgentTransportsHandler) List ¶ added in v4.1.0
func (h *AgentTransportsHandler) List(c *gin.Context)
List godoc @Summary Agent transport inventory @Description Lists every proxy and forward node with the transport its agent was last seen on (mtls-stream, apikey-stream, http-legacy, websocket, clean-agent, uniproxy, v2board-grpc), its agent version, its newest valid agent certificate, when it was last seen and its live Agent Control stream session (authentication mtls or api-key, certificate serial, expiry and SAN, negotiated capabilities). Each node also carries certificate_state (valid, revoked, expired or none), last_certificate (its newest certificate in any state: serial, issued_at, not_after, renew_after, revoked_at and revoke_reason) and connection (type mtls_stream, apikey_stream, legacy, third_party or offline, the transport and when it was last seen). legacy_only=true keeps the nodes on a legacy AnixOps Agent channel; node=proxy-7 (repeatable or comma separated, at most 200) keeps the named nodes. summary.ready_for_required (with required_reasons and required_blockers, computed over every node) is false while agent_control.mtls: required, the default from v4.2, would refuse an enabled node: a legacy one or one that never enrolled. @Tags Kernel @Produce json @Security BearerAuth @Param legacy_only query bool false "only nodes on a legacy AnixOps Agent channel" @Param node query []string false "only these nodes (proxy-<id> or forward-<id>), repeatable or comma separated" collectionFormat(multi) @Success 200 {object} map[string]any @Router /api/v4/kernel/agents/transports [get]
type AgentUpgradesHandler ¶ added in v4.2.0
type AgentUpgradesHandler struct {
// contains filtered or unexported fields
}
AgentUpgradesHandler serves staged Agent upgrade campaigns (forward-sdk.md section 9, O4): super administrators start, pause, resume and abort them; administrators read them. The worker in the singleton-worker process drives them (internal/agentupgrade).
func NewAgentUpgradesHandler ¶ added in v4.2.0
func NewAgentUpgradesHandler() *AgentUpgradesHandler
NewAgentUpgradesHandler reads the loaded configuration and database on each request.
func (*AgentUpgradesHandler) Abort ¶ added in v4.2.0
func (h *AgentUpgradesHandler) Abort(c *gin.Context)
Abort godoc @Summary Abort an Agent upgrade campaign @Description Ends the campaign. With rollback the upgraded nodes of the current batch are told to reinstate their previous release first. Super administrators only. @Tags Kernel @Accept json @Produce json @Security BearerAuth @Param id path string true "campaign id" @Param request body abortAgentUpgradeRequest false "rollback" @Success 200 {object} map[string]any @Router /api/v4/kernel/agents/upgrades/{id}/abort [post]
func (*AgentUpgradesHandler) Get ¶ added in v4.2.0
func (h *AgentUpgradesHandler) Get(c *gin.Context)
Get godoc @Summary Get an Agent upgrade campaign @Description One campaign with its artifacts, batches and every node in canary order with its state, versions, timestamps and error code. @Tags Kernel @Produce json @Security BearerAuth @Param id path string true "campaign id" @Success 200 {object} map[string]any @Router /api/v4/kernel/agents/upgrades/{id} [get]
func (*AgentUpgradesHandler) List ¶ added in v4.2.0
func (h *AgentUpgradesHandler) List(c *gin.Context)
List godoc @Summary List Agent upgrade campaigns @Description The latest Agent upgrade campaigns, newest first, each with its batches and nodes counted by state (pending, offered, upgrading, succeeded, failed, rolled_back, skipped). @Tags Kernel @Produce json @Security BearerAuth @Param limit query int false "at most 100, default 20" @Success 200 {object} map[string]any @Router /api/v4/kernel/agents/upgrades [get]
func (*AgentUpgradesHandler) Pause ¶ added in v4.2.0
func (h *AgentUpgradesHandler) Pause(c *gin.Context)
Pause godoc @Summary Pause an Agent upgrade campaign @Description No node is offered the upgrade and no batch starts; nodes already offered are still evaluated and a failing batch still rolls back. Super administrators only. @Tags Kernel @Produce json @Security BearerAuth @Param id path string true "campaign id" @Success 200 {object} map[string]any @Router /api/v4/kernel/agents/upgrades/{id}/pause [post]
func (*AgentUpgradesHandler) Resume ¶ added in v4.2.0
func (h *AgentUpgradesHandler) Resume(c *gin.Context)
Resume godoc @Summary Resume an Agent upgrade campaign @Description Continues a paused campaign; the paused time does not count towards the batch's minimum duration. Super administrators only. @Tags Kernel @Produce json @Security BearerAuth @Param id path string true "campaign id" @Success 200 {object} map[string]any @Router /api/v4/kernel/agents/upgrades/{id}/resume [post]
func (*AgentUpgradesHandler) Start ¶ added in v4.2.0
func (h *AgentUpgradesHandler) Start(c *gin.Context)
Start godoc @Summary Start a staged Agent upgrade @Description Pushes an Agent release to every enabled node whose Agent was seen on the Agent Control stream, in batches (default 5%, 25%, 100% of the nodes, at least 30 minutes each; canaries first by node name hash), as the agent.upgrade operation to Agents that negotiated upgrade.v1. A batch rolls back when more than 5% of its offered nodes fail or do not reconnect with the target version within 10 minutes (H19). The release must be in agent_install.artifact_dir with its .sig files and SHA256SUMS(.sig), verified with plugins.official_public_key. Super administrators only; one campaign at a time. @Tags Kernel @Accept json @Produce json @Security BearerAuth @Param request body startAgentUpgradeRequest true "target_version (default this Control's Agent release), batches, exclude {nodes, tags}, reason" @Success 201 {object} map[string]any @Router /api/v4/kernel/agents/upgrades [post]
type AuthHandler ¶
type AuthHandler struct {
// contains filtered or unexported fields
}
func NewAuthHandler ¶
func NewAuthHandler(cfg *config.Config) *AuthHandler
func (*AuthHandler) Login ¶
func (h *AuthHandler) Login(c *gin.Context)
Login godoc @Summary 用户登录 @Description 用户登录获取 JWT Token @Tags 认证 @Accept json @Produce json @Param request body model.LoginRequest true "登录请求" @Success 200 {object} map[string]any "登录成功" @Failure 401 {object} map[string]any "认证失败" @Router /login [post]
func (*AuthHandler) Register ¶
func (h *AuthHandler) Register(c *gin.Context)
Register godoc @Summary 用户注册 @Description 创建新用户账户 @Tags 认证 @Accept json @Produce json @Param request body model.RegisterRequest true "注册请求" @Success 200 {object} map[string]any "注册成功" @Failure 400 {object} map[string]any "参数错误" @Router /register [post]
type BroadcastRequest ¶
type BroadcastRequest struct {
Message string `json:"message" binding:"required"`
}
BroadcastRequest 广播请求
type BulkActionRoute ¶ added in v4.2.0
type BulkActionRoute struct {
// Endpoint is the bulk endpoint ("/api/v4/admin/users/bulk").
Endpoint string
Action string
Method string
// Pattern is the route as the router registers it (".../users/:id/ban").
Pattern string
}
BulkActionRoute names the single-item route a bulk action repeats.
func BulkActionRoutes ¶ added in v4.2.0
func BulkActionRoutes() []BulkActionRoute
BulkActionRoutes lists every bulk action with the single-item route it repeats, so the router's tests can check that each exists.
type BulkAnswer ¶ added in v4.2.0
BulkAnswer is what the single-item route answered.
type BulkCall ¶ added in v4.2.0
type BulkCall struct {
Method string
Path string
Params gin.Params
// IdempotencyKey makes the single-item request apply once when the bulk
// request is retried.
IdempotencyKey string
// RequestID identifies the single-item request in logs and ledgers.
RequestID string
}
BulkCall is one single-item request of a bulk request.
type BulkError ¶ added in v4.2.0
type BulkError struct {
// Code is machine readable: not_found, conflict, forbidden_self, failed,
// not_attempted, or a code of the package gateway (package_route_frozen,
// plugin_host_unavailable, ...).
Code string `json:"code"`
Message string `json:"message"`
}
BulkError is why one item of a bulk request was not done.
type BulkItemResult ¶ added in v4.2.0
type BulkItemResult struct {
ID uint `json:"id"`
OK bool `json:"ok"`
Error *BulkError `json:"error,omitempty"`
}
BulkItemResult is the outcome of one id, in the order of the request.
type BulkResult ¶ added in v4.2.0
type BulkResult struct {
Action string `json:"action"`
Requested int `json:"requested"`
Succeeded int `json:"succeeded"`
Failed int `json:"failed"`
Results []BulkItemResult `json:"results"`
}
BulkResult is the answer of a bulk request.
type BulkRunner ¶ added in v4.2.0
BulkRunner runs one single-item request as the administrator who sent the bulk request (parent), within ctx, and answers what the route answered. The router's runner (GatewayBulkRunner) goes through the /api/v2 package gateway, so a route runs wherever its mode puts it: in the identity package or in the kernel's legacy handler.
func GatewayBulkRunner ¶ added in v4.2.0
func GatewayBulkRunner(gateway gin.HandlerFunc) BulkRunner
GatewayBulkRunner runs each item through the /api/v2 package gateway (compatv2.Gateway.Serve, the handler of the single-item routes) with a request of its own built from the bulk request: the administrator's identity and client address, the item's method, path and id, and its own Idempotency-Key and request id. The router's middleware (rate limit, authentication, audit) is not run again: the bulk request passed it once, and the bulk handler audits each item itself.
type CouponHandler ¶
type CouponHandler struct{}
CouponHandler 用户端优惠券处理器
func (*CouponHandler) CheckCoupon ¶
func (h *CouponHandler) CheckCoupon(c *gin.Context)
CheckCoupon 校验优惠券是否可用
type CreateGatewayRequest ¶
type CreateGatewayRequest struct {
Name string `json:"name" binding:"required"`
Type string `json:"type" binding:"required,oneof=alipay wechat stripe usdt epay"`
Icon string `json:"icon"`
Config any `json:"config"`
FeeRate float64 `json:"fee_rate"`
FeeFixed float64 `json:"fee_fixed"`
MinAmount float64 `json:"min_amount"`
MaxAmount float64 `json:"max_amount"`
Sort int `json:"sort"`
Description string `json:"description"`
}
CreateGatewayRequest 创建网关请求
type CreateNodeRequest ¶
type CreateNodeRequest struct {
Name string `json:"name" binding:"required"`
Type string `json:"type" binding:"required,oneof=relay exit"`
Host string `json:"host" binding:"required"`
Port int `json:"port" binding:"required,min=1,max=65535"`
APIPort int `json:"api_port"`
APIToken string `json:"api_token"`
MetricsPort int `json:"metrics_port"`
Region string `json:"region"`
ISP string `json:"isp"`
Bandwidth int64 `json:"bandwidth"`
Weight int `json:"weight"`
MaxConn int `json:"max_conn"`
}
CreateNodeRequest 创建节点请求
type CreatePaymentRequest ¶
type CreatePaymentRequest struct {
GatewayID uint `json:"gateway_id" binding:"required"`
Amount float64 `json:"amount" binding:"required,min=1"`
OrderID *uint `json:"order_id"`
}
CreatePaymentRequest 创建支付请求
type CreateRuleRequest ¶
type CreateRuleRequest struct {
Name string `json:"name" binding:"required"`
RelayNodeID uint `json:"relay_node_id" binding:"required"`
ListenPort int `json:"listen_port" binding:"required,min=1,max=65535"`
Protocol string `json:"protocol" binding:"omitempty,oneof=tcp udp both"`
ExitNodeID uint `json:"exit_node_id" binding:"required"`
TargetHost string `json:"target_host" binding:"required"`
TargetPort int `json:"target_port" binding:"required,min=1,max=65535"`
UserID *uint `json:"user_id"`
UserGroupID *uint `json:"user_group_id"`
SpeedLimit *int64 `json:"speed_limit"`
TrafficLimit *int64 `json:"traffic_limit"`
ExpireTime *time.Time `json:"expire_time"`
Remark string `json:"remark"`
}
CreateRuleRequest 创建规则请求
type CreateTaskRequest ¶
type CreateTaskRequest struct {
NodeID uint `json:"node_id" binding:"required"`
Type string `json:"type" binding:"required"`
Action string `json:"action" binding:"required"`
Params map[string]any `json:"params"`
Timeout int `json:"timeout"`
}
CreateTaskRequest 创建任务请求
type DeltaData ¶
type DeltaData struct {
Overview *MonitorOverview `json:"overview,omitempty"`
NodeUpdates []NodeDelta `json:"node_updates"`
}
DeltaData 增量数据
type ExecuteCommandRequest ¶
type ExecuteCommandRequest struct {
NodeID uint `json:"node_id" binding:"required"`
Action string `json:"action" binding:"required"`
Params map[string]any `json:"params"`
Timeout int `json:"timeout"`
}
ExecuteCommandRequest 白名单诊断动作请求
type ForwardCleanAgentHandler ¶
type ForwardCleanAgentHandler struct {
// contains filtered or unexported fields
}
func NewForwardCleanAgentHandler ¶
func NewForwardCleanAgentHandler() *ForwardCleanAgentHandler
func (*ForwardCleanAgentHandler) Heartbeat ¶
func (h *ForwardCleanAgentHandler) Heartbeat(c *gin.Context)
func (*ForwardCleanAgentHandler) Register ¶
func (h *ForwardCleanAgentHandler) Register(c *gin.Context)
func (*ForwardCleanAgentHandler) Report ¶
func (h *ForwardCleanAgentHandler) Report(c *gin.Context)
type ForwardHandler ¶
type ForwardHandler struct {
// contains filtered or unexported fields
}
ForwardHandler 转发处理器
func (*ForwardHandler) AssignPanelUserTunnel ¶
func (h *ForwardHandler) AssignPanelUserTunnel(c *gin.Context)
func (*ForwardHandler) CreatePanelTunnel ¶
func (h *ForwardHandler) CreatePanelTunnel(c *gin.Context)
func (*ForwardHandler) DeletePanelTunnel ¶
func (h *ForwardHandler) DeletePanelTunnel(c *gin.Context)
func (*ForwardHandler) DiagnoseLocalRuntime ¶
func (h *ForwardHandler) DiagnoseLocalRuntime(c *gin.Context)
func (*ForwardHandler) DiagnoseNodeXRuntime ¶
func (h *ForwardHandler) DiagnoseNodeXRuntime(c *gin.Context)
func (*ForwardHandler) DiagnosePanelRuntime ¶
func (h *ForwardHandler) DiagnosePanelRuntime(c *gin.Context)
func (*ForwardHandler) GetForwardStats ¶
func (h *ForwardHandler) GetForwardStats(c *gin.Context)
GetForwardStats godoc @Summary 获取转发统计 @Description 管理员获取转发统计数据,包括节点数、在线数、流量等 @Tags 管理端-转发 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Router /admin/forward/stats [get]
func (*ForwardHandler) GetLocalRuntimeStatus ¶
func (h *ForwardHandler) GetLocalRuntimeStatus(c *gin.Context)
func (*ForwardHandler) GetNodeXRuntimeStatus ¶
func (h *ForwardHandler) GetNodeXRuntimeStatus(c *gin.Context)
func (*ForwardHandler) GetObservabilityMultiIngress ¶
func (h *ForwardHandler) GetObservabilityMultiIngress(c *gin.Context)
GetObservabilityMultiIngress GET /admin/forward/observability/multi-ingress?targetId=
func (*ForwardHandler) GetPanelRuntimeStatus ¶
func (h *ForwardHandler) GetPanelRuntimeStatus(c *gin.Context)
func (*ForwardHandler) GetUserRules ¶
func (h *ForwardHandler) GetUserRules(c *gin.Context)
GetUserRules godoc @Summary 获取用户的转发规则 @Description 用户获取自己的转发规则列表 @Tags 用户端 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /user/forward/rules [get]
func (*ForwardHandler) ListPanelAdminTunnels ¶
func (h *ForwardHandler) ListPanelAdminTunnels(c *gin.Context)
func (*ForwardHandler) ListPanelForwards ¶
func (h *ForwardHandler) ListPanelForwards(c *gin.Context)
func (*ForwardHandler) ListPanelTunnels ¶
func (h *ForwardHandler) ListPanelTunnels(c *gin.Context)
func (*ForwardHandler) ListPanelUserTunnels ¶
func (h *ForwardHandler) ListPanelUserTunnels(c *gin.Context)
func (*ForwardHandler) ReportPanelForwardTraffic ¶
func (h *ForwardHandler) ReportPanelForwardTraffic(c *gin.Context)
func (*ForwardHandler) SnapshotPanelForwardTraffic ¶
func (h *ForwardHandler) SnapshotPanelForwardTraffic(c *gin.Context)
func (*ForwardHandler) TestGostConnection ¶
func (h *ForwardHandler) TestGostConnection(c *gin.Context)
TestGostConnection godoc @Summary 测试 gost 节点连接 @Description 测试与 gost 节点的 API 连接是否正常 @Tags 管理端-转发 @Accept json @Produce json @Security BearerAuth @Param request body TestGostConnectionRequest true "连接信息" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /admin/forward/test-connection [post]
func (*ForwardHandler) UpdatePanelForwardOrder ¶
func (h *ForwardHandler) UpdatePanelForwardOrder(c *gin.Context)
func (*ForwardHandler) UploadPanelFlowData ¶
func (h *ForwardHandler) UploadPanelFlowData(c *gin.Context)
type ForwardRuleForAgent ¶
type ForwardRuleForAgent struct {
ID uint `json:"id"`
Enabled bool `json:"enabled"`
ListenPort int `json:"listen_port"`
Protocol string `json:"protocol"`
TargetHost string `json:"target_host"`
TargetPort int `json:"target_port"`
}
ForwardRuleForAgent 转发规则(Agent 格式)
type ForwardV4Docs ¶ added in v4.2.0
type ForwardV4Docs struct{}
ForwardV4Docs documents the forward package's /api/v4/forward/* for Swagger. The package answers every route (packages/forward/v4api); the kernel's ForwardGateway dispatches them, so these methods are never routed. Answers are {"data": ...}; refusals {"error": {"code", "message", "violations"}}; contract messages are protojson with the proto field names, and their 64-bit integers are JSON strings.
func (ForwardV4Docs) CreateAnsibleMachine ¶ added in v4.2.0
func (ForwardV4Docs) CreateAnsibleMachine(*gin.Context)
CreateAnsibleMachine godoc @Summary Add an Ansible machine @Description Body as POST /nodes; the transport is NODE_TRANSPORT_ANSIBLE. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param body body object true "CreateForwardNodeRequest (protojson)" @Success 201 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 409 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/ansible-machines [post]
func (ForwardV4Docs) CreateDNSBinding ¶ added in v4.2.0
func (ForwardV4Docs) CreateDNSBinding(*gin.Context)
CreateDNSBinding godoc @Summary Bind a route's entries to a DNS name @Description Body: a DnsBinding (route_id, provider_id, zone, record_name, mode DNS_BINDING_MODE_DDNS or _CNAME, record_types, ttl, paused). In DDNS mode record_name is the route's entry_hostname; in CNAME mode a Control-managed name the operator points entry_hostname at. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param body body object true "DnsBinding" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 409 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/dns/bindings [post]
func (ForwardV4Docs) CreateDNSProvider ¶ added in v4.2.0
func (ForwardV4Docs) CreateDNSProvider(*gin.Context)
CreateDNSProvider godoc @Summary Add a DNS provider (super administrator) @Description Body: {provider: DnsProvider, credentials: {name: value}}. Credentials are sealed with module_runtime.ca_kek and never answered; 409 refused (secret_store_unavailable) without it. Audited with the credentials redacted. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param body body object true "{provider, credentials}" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 403 {object} map[string]any @Failure 409 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/dns/providers [post]
func (ForwardV4Docs) CreateNode ¶ added in v4.2.0
func (ForwardV4Docs) CreateNode(*gin.Context)
CreateNode godoc @Summary Add a forward node @Description Body: {node: ForwardNodeRecord, settings?: NodeSettings}. No answer carries a node credential; the node enrolls its Agent with an install token. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param body body object true "CreateForwardNodeRequest (protojson)" @Success 201 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 409 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/nodes [post]
func (ForwardV4Docs) CreateRoute ¶ added in v4.2.0
func (ForwardV4Docs) CreateRoute(*gin.Context)
CreateRoute godoc @Summary Create a route @Description Body: a Route (protojson, proto field names). Control assigns id, revision and times. 400 invalid_route or 409 refused carry violations with sdk/forward/validate codes. Idempotency-Key makes a retry apply once. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param body body object true "Route (protojson)" @Success 201 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 409 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/routes [post]
func (ForwardV4Docs) DNSKinds ¶ added in v4.2.0
func (ForwardV4Docs) DNSKinds(*gin.Context)
DNSKinds godoc @Summary DNS provider kinds @Description The provider kinds (Cloudflare, Alibaba Cloud DNS, DNSPod, Huawei Cloud DNS, webhook) with their settings and credential names, for a form. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/dns/kinds [get]
func (ForwardV4Docs) DeleteAnsibleMachine ¶ added in v4.2.0
func (ForwardV4Docs) DeleteAnsibleMachine(*gin.Context)
DeleteAnsibleMachine godoc @Summary Delete an Ansible machine @Description Super administrators only. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param id path int true "Forward node id" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 403 {object} map[string]any @Failure 404 {object} map[string]any @Failure 409 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/ansible-machines/{id} [delete]
func (ForwardV4Docs) DeleteDNSBinding ¶ added in v4.2.0
func (ForwardV4Docs) DeleteDNSBinding(*gin.Context)
DeleteDNSBinding godoc @Summary Delete a route DNS binding (super administrator) @Description Query purge=true first deletes the records Control published; 502 dns_purge_failed when the provider refuses, and the binding stays. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param id path string true "Binding id" @Param purge query bool false "Delete the published records first" @Success 200 {object} map[string]any @Failure 403 {object} map[string]any @Failure 404 {object} map[string]any @Failure 502 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/dns/bindings/{id} [delete]
func (ForwardV4Docs) DeleteDNSProvider ¶ added in v4.2.0
func (ForwardV4Docs) DeleteDNSProvider(*gin.Context)
DeleteDNSProvider godoc @Summary Delete a DNS provider (super administrator) @Description 409 refused (provider_in_use) while a binding uses it. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param id path string true "Provider id" @Success 200 {object} map[string]any @Failure 403 {object} map[string]any @Failure 404 {object} map[string]any @Failure 409 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/dns/providers/{id} [delete]
func (ForwardV4Docs) DeleteNode ¶ added in v4.2.0
func (ForwardV4Docs) DeleteNode(*gin.Context)
DeleteNode godoc @Summary Delete a forward node @Description Super administrators only. 409 refused (node_in_use) while a route uses it. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param ref path string true "forward-<id>" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 403 {object} map[string]any @Failure 404 {object} map[string]any @Failure 409 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/nodes/{ref} [delete]
func (ForwardV4Docs) DeleteRoute ¶ added in v4.2.0
func (ForwardV4Docs) DeleteRoute(*gin.Context)
DeleteRoute godoc @Summary Delete a route @Description Super administrators only. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param id path string true "Route id" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 403 {object} map[string]any @Failure 404 {object} map[string]any @Failure 409 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/routes/{id} [delete]
func (ForwardV4Docs) DiagnoseRoute ¶ added in v4.2.0
func (ForwardV4Docs) DiagnoseRoute(*gin.Context)
DiagnoseRoute godoc @Summary Diagnose a route @Description Staged diagnosis (forward-sdk.md section 7.6): Control's records (generations, hop errors, health and breakers), node probes through agent.diagnostic where the Agent offers them (listen, port conflicts, next-hop connect, delivery to the targets, UDP exchange), and dials from Control for the rest. Optional body {"timeout_ms": n} (15000 by default, at most 25000). A diagnosis of the same route from the last 10 seconds is answered with cached true; 429 rate_limited when too many run. Audited as forward/diagnose. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param id path string true "Route id" @Param body body object false "Optional timeout_ms" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 429 {object} map[string]any @Failure 503 {object} map[string]any @Failure 504 {object} map[string]any @Router /api/v4/forward/routes/{id}/diagnose [post]
func (ForwardV4Docs) GetAnsibleMachine ¶ added in v4.2.0
func (ForwardV4Docs) GetAnsibleMachine(*gin.Context)
GetAnsibleMachine godoc @Summary An Ansible machine @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param id path int true "Forward node id" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/ansible-machines/{id} [get]
func (ForwardV4Docs) GetDNSBinding ¶ added in v4.2.0
func (ForwardV4Docs) GetDNSBinding(*gin.Context)
GetDNSBinding godoc @Summary A route DNS binding @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param id path string true "Binding id" @Success 200 {object} map[string]any @Failure 404 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/dns/bindings/{id} [get]
func (ForwardV4Docs) GetDNSProvider ¶ added in v4.2.0
func (ForwardV4Docs) GetDNSProvider(*gin.Context)
GetDNSProvider godoc @Summary A DNS provider @Description Without credentials. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param id path string true "Provider id" @Success 200 {object} map[string]any @Failure 404 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/dns/providers/{id} [get]
func (ForwardV4Docs) GetNode ¶ added in v4.2.0
func (ForwardV4Docs) GetNode(*gin.Context)
GetNode godoc @Summary A node with its desired state and latest report @Description The applied generation, hop errors and upstream health. Replaces the v2 node detail and check. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param ref path string true "forward-<id> or proxy-<id>" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/nodes/{ref} [get]
func (ForwardV4Docs) GetRoute ¶ added in v4.2.0
func (ForwardV4Docs) GetRoute(*gin.Context)
GetRoute godoc @Summary Get a route @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param id path string true "Route id" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/routes/{id} [get]
func (ForwardV4Docs) ListAnsibleMachines ¶ added in v4.2.0
func (ForwardV4Docs) ListAnsibleMachines(*gin.Context)
ListAnsibleMachines godoc @Summary List the Ansible machines @Description Forward nodes on the Ansible transport. Replaces GET /api/v2/admin/forward/ansible-machines. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/ansible-machines [get]
func (ForwardV4Docs) ListDNSBindings ¶ added in v4.2.0
func (ForwardV4Docs) ListDNSBindings(*gin.Context)
ListDNSBindings godoc @Summary List route DNS bindings @Description Query: route_id, provider_id. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param route_id query string false "Route filter" @Param provider_id query string false "Provider filter" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/dns/bindings [get]
func (ForwardV4Docs) ListDNSProviders ¶ added in v4.2.0
func (ForwardV4Docs) ListDNSProviders(*gin.Context)
ListDNSProviders godoc @Summary List DNS providers @Description DNS provider accounts with credential_names and the number of bindings; credentials are never answered. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/dns/providers [get]
func (ForwardV4Docs) ListNodes ¶ added in v4.2.0
func (ForwardV4Docs) ListNodes(*gin.Context)
ListNodes godoc @Summary List the node inventory @Description Every forward node and the proxy nodes in the forwarding inventory, with settings, the planner's view and desired and reported generations. Replaces GET /api/v2/admin/forward/nodes. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param kind query string false "forward or proxy" @Param transport query string false "agent or ansible" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/nodes [get]
func (ForwardV4Docs) ListRoutes ¶ added in v4.2.0
func (ForwardV4Docs) ListRoutes(*gin.Context)
ListRoutes godoc @Summary List routes @Description Routes with Control's enforcement reason. Query: owner, node_ref, page_size, page_token. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param owner query string false "Owner filter (admin)" @Param node_ref query string false "Routes with a hop on this node" @Param page_size query int false "Page size (100, at most 1000)" @Param page_token query string false "next_page_token of the previous page" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/routes [get]
func (ForwardV4Docs) ObservabilityTargets ¶ added in v4.2.0
func (ForwardV4Docs) ObservabilityTargets(*gin.Context)
ObservabilityTargets godoc @Summary Every route target with its health @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param node_ref query string false "Routes with a hop on this node" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/observability/targets [get]
func (ForwardV4Docs) ObservabilityTopology ¶ added in v4.2.0
func (ForwardV4Docs) ObservabilityTopology(*gin.Context)
ObservabilityTopology godoc @Summary Nodes, hops and targets as a graph @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/observability/topology [get]
func (ForwardV4Docs) ObservabilityTrend ¶ added in v4.2.0
func (ForwardV4Docs) ObservabilityTrend(*gin.Context)
ObservabilityTrend godoc @Summary Hourly traffic trend @Description The kernel keeps no latency history: the trend is traffic. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param route_id query string false "Route filter" @Param node_ref query string false "Node filter" @Param since query int false "Unix milliseconds" @Param until query int false "Unix milliseconds" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/observability/trend [get]
func (ForwardV4Docs) PauseRoute ¶ added in v4.2.0
func (ForwardV4Docs) PauseRoute(*gin.Context)
PauseRoute godoc @Summary Pause a route @Description Keeps the route's ports, marks, counters and quota; the drivers drop its traffic. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param id path string true "Route id" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 409 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/routes/{id}/pause [post]
func (ForwardV4Docs) PreviewRoute ¶ added in v4.2.0
func (ForwardV4Docs) PreviewRoute(*gin.Context)
PreviewRoute godoc @Summary Plan a route without storing it @Description Body: a PlanRouteRequest. Answers the per-node states, allocations, violations and warnings. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param body body object true "PlanRouteRequest (protojson)" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 409 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/routes/preview [post]
func (ForwardV4Docs) ResumeRoute ¶ added in v4.2.0
func (ForwardV4Docs) ResumeRoute(*gin.Context)
ResumeRoute godoc @Summary Resume a route @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param id path string true "Route id" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 409 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/routes/{id}/resume [post]
func (ForwardV4Docs) RouteDNS ¶ added in v4.2.0
func (ForwardV4Docs) RouteDNS(*gin.Context)
RouteDNS godoc @Summary A route's entry HA DNS status @Description Entry HA through DNS (forward-sdk.md section 7.4, L2): the route's binding, the published and desired A/AAAA records, each entry node's health (healthy, in_rotation, good and bad streaks, reason), state (unbound, pending, ok, degraded, error, rate_limited, paused, route_missing, hostname_mismatch), cname_target in CNAME mode and the last provider error. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param id path string true "Route id" @Success 200 {object} map[string]any @Failure 404 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/routes/{id}/dns [get]
func (ForwardV4Docs) RouteHealth ¶ added in v4.2.0
func (ForwardV4Docs) RouteHealth(*gin.Context)
RouteHealth godoc @Summary A route's upstream health @Description The latest health and latency probe of every upstream, from the nodes' reports. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param id path string true "Route id" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/routes/{id}/health [get]
func (ForwardV4Docs) RouteStats ¶ added in v4.2.0
func (ForwardV4Docs) RouteStats(*gin.Context)
RouteStats godoc @Summary A route's traffic @Description Ledger totals per hop and node, and the hourly series over since/until (Unix milliseconds). @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param id path string true "Route id" @Param since query int false "Unix milliseconds" @Param until query int false "Unix milliseconds" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/routes/{id}/stats [get]
func (ForwardV4Docs) SetNodeSettings ¶ added in v4.2.0
func (ForwardV4Docs) SetNodeSettings(*gin.Context)
SetNodeSettings godoc @Summary Replace a node's forwarding settings @Description Body: NodeSettings (port range, reserved ports, addresses, labels). A replan the settings make impossible still stores them; violations say why. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param ref path string true "forward-<id> or proxy-<id>" @Param body body object true "NodeSettings (protojson)" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 409 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/nodes/{ref}/settings [put]
func (ForwardV4Docs) Stats ¶ added in v4.2.0
func (ForwardV4Docs) Stats(*gin.Context)
Stats godoc @Summary Traffic totals and the hourly series @Description Raw metered bytes (no multiplier) per route, hop and node, per node, and the hourly buckets. Replaces the v2 sync-stats. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param route_id query string false "Route filter" @Param node_ref query string false "Node filter" @Param since query int false "Unix milliseconds (default: 24 hours ago)" @Param until query int false "Unix milliseconds" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/stats [get]
func (ForwardV4Docs) ToggleAnsibleMachine ¶ added in v4.2.0
func (ForwardV4Docs) ToggleAnsibleMachine(*gin.Context)
ToggleAnsibleMachine godoc @Summary Enable or disable an Ansible machine @Description Body: {enabled: bool}. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param id path int true "Forward node id" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 409 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/ansible-machines/{id}/toggle [post]
func (ForwardV4Docs) ToggleNode ¶ added in v4.2.0
func (ForwardV4Docs) ToggleNode(*gin.Context)
ToggleNode godoc @Summary Enable or disable a forward node @Description Body: {enabled: bool}. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param ref path string true "forward-<id>" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 409 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/nodes/{ref}/toggle [post]
func (ForwardV4Docs) UpdateAnsibleMachine ¶ added in v4.2.0
func (ForwardV4Docs) UpdateAnsibleMachine(*gin.Context)
UpdateAnsibleMachine godoc @Summary Replace an Ansible machine's fields @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param id path int true "Forward node id" @Param body body object true "ForwardNodeRecord (protojson)" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 409 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/ansible-machines/{id} [put]
func (ForwardV4Docs) UpdateDNSBinding ¶ added in v4.2.0
func (ForwardV4Docs) UpdateDNSBinding(*gin.Context)
UpdateDNSBinding godoc @Summary Replace a binding's record types, TTL and paused flag @Description Body: the whole DnsBinding, as GET answers it. It replaces record_types, ttl and paused (an omitted one takes its default: A, 60, false; a record type dropped has its records deleted); route, provider, zone, record_name and mode cannot change (400 immutable). @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param id path string true "Binding id" @Param body body object true "DnsBinding" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/dns/bindings/{id} [put]
func (ForwardV4Docs) UpdateDNSProvider ¶ added in v4.2.0
func (ForwardV4Docs) UpdateDNSProvider(*gin.Context)
UpdateDNSProvider godoc @Summary Replace a DNS provider (super administrator) @Description Body: {provider: DnsProvider, credentials: {name: value}}; a credential left out, or "********", keeps the stored value. The kind cannot change. @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param id path string true "Provider id" @Param body body object true "{provider, credentials}" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 403 {object} map[string]any @Failure 404 {object} map[string]any @Failure 409 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/dns/providers/{id} [put]
func (ForwardV4Docs) UpdateNode ¶ added in v4.2.0
func (ForwardV4Docs) UpdateNode(*gin.Context)
UpdateNode godoc @Summary Replace a forward node's fields @Description Body: ForwardNodeRecord. Disabling a node a route uses is 409 refused (node_in_use). @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param ref path string true "forward-<id>" @Param body body object true "ForwardNodeRecord (protojson)" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 409 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/nodes/{ref} [put]
func (ForwardV4Docs) UpdateRoute ¶ added in v4.2.0
func (ForwardV4Docs) UpdateRoute(*gin.Context)
UpdateRoute godoc @Summary Replace a route @Description Body: the whole Route; its revision is the revision it replaces (409 revision_conflict when stale). @Tags Forward v4 @Accept json @Produce json @Security BearerAuth @Param id path string true "Route id" @Param body body object true "Route (protojson)" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 409 {object} map[string]any @Failure 503 {object} map[string]any @Router /api/v4/forward/routes/{id} [put]
type InviteCodeAdminHandler ¶ added in v4.1.0
type InviteCodeAdminHandler struct {
// contains filtered or unexported fields
}
InviteCodeAdminHandler serves the administrator's invite codes (registration control): list, generate and revoke. identity-platform declares the routes and the identity bridge relays them here, in every edition; commissions, withdrawals and invite statistics stay in the affiliate package (InviteHandler).
func NewInviteCodeAdminHandler ¶ added in v4.1.0
func NewInviteCodeAdminHandler() *InviteCodeAdminHandler
NewInviteCodeAdminHandler returns the handler on the kernel database.
func (*InviteCodeAdminHandler) GenerateCodes ¶ added in v4.1.0
func (h *InviteCodeAdminHandler) GenerateCodes(c *gin.Context)
GenerateCodes godoc @Summary Generate invite codes @Description Generates 1 to 50 codes that belong to no user. expire_days overrides the configured expiry (0: never). @Tags admin-invite-codes @Accept json @Produce json @Security BearerAuth @Param request body map[string]any false "{count, expire_days}" @Success 200 {object} map[string]any @Router /admin/invite/codes [post]
func (*InviteCodeAdminHandler) ListCodes ¶ added in v4.1.0
func (h *InviteCodeAdminHandler) ListCodes(c *gin.Context)
ListCodes godoc @Summary List invite codes @Description Every invite code, newest first; status filters unused, used or expired codes. @Tags admin-invite-codes @Produce json @Security BearerAuth @Param status query string false "unused, used or expired" @Param page query int false "page" default(1) @Param page_size query int false "page size" default(20) @Success 200 {object} map[string]any @Router /admin/invite/codes [get]
func (*InviteCodeAdminHandler) RevokeCode ¶ added in v4.1.0
func (h *InviteCodeAdminHandler) RevokeCode(c *gin.Context)
RevokeCode godoc @Summary Revoke an invite code @Description Deletes an unused invite code; a used code is kept. @Tags admin-invite-codes @Produce json @Security BearerAuth @Param id path int true "invite code id" @Success 200 {object} map[string]any @Router /admin/invite/codes/{id} [delete]
type InviteHandler ¶
type InviteHandler struct {
// contains filtered or unexported fields
}
InviteHandler 邀请处理器
func (*InviteHandler) GenerateCode ¶
func (h *InviteHandler) GenerateCode(c *gin.Context)
GenerateCode godoc @Summary 生成邀请码 @Description 用户生成新的邀请码 @Tags 用户端 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /user/invite/generate [post]
func (*InviteHandler) GetCommissionRecords ¶
func (h *InviteHandler) GetCommissionRecords(c *gin.Context)
GetCommissionRecords godoc @Summary 获取佣金记录 @Description 用户获取自己的佣金记录列表 @Tags 用户端 @Accept json @Produce json @Security BearerAuth @Param page query int false "页码" default(1) @Param page_size query int false "每页数量" default(20) @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /user/invite/commissions [get]
func (*InviteHandler) GetConfig ¶
func (h *InviteHandler) GetConfig(c *gin.Context)
GetConfig godoc @Summary 获取邀请配置 @Description 管理员获取邀请系统配置 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/invite/config [get]
func (*InviteHandler) GetInviteInfo ¶
func (h *InviteHandler) GetInviteInfo(c *gin.Context)
GetInviteInfo godoc @Summary 获取邀请信息 @Description 用户获取自己的邀请码和佣金信息 @Tags 用户端 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /user/invite [get]
func (*InviteHandler) GetInviteStats ¶
func (h *InviteHandler) GetInviteStats(c *gin.Context)
GetInviteStats godoc @Summary 获取邀请统计 @Description 管理员获取邀请系统统计数据 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Router /admin/invite/stats [get]
func (*InviteHandler) GetWithdrawRecords ¶
func (h *InviteHandler) GetWithdrawRecords(c *gin.Context)
GetWithdrawRecords godoc @Summary 获取提现记录 @Description 用户获取自己的提现记录列表 @Tags 用户端 @Accept json @Produce json @Security BearerAuth @Param page query int false "页码" default(1) @Param page_size query int false "每页数量" default(20) @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /user/invite/withdrawals [get]
func (*InviteHandler) GetWithdrawals ¶
func (h *InviteHandler) GetWithdrawals(c *gin.Context)
GetWithdrawals godoc @Summary 获取提现申请列表 @Description 管理员获取提现申请列表 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Param status query string false "Status filter" @Param page query int false "页码" default(1) @Param page_size query int false "每页数量" default(20) @Success 200 {object} map[string]any @Router /admin/invite/withdrawals [get]
func (*InviteHandler) ProcessWithdraw ¶
func (h *InviteHandler) ProcessWithdraw(c *gin.Context)
ProcessWithdraw godoc @Summary 处理提现申请 @Description 管理员处理提现申请,批准或拒绝 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Param id path int true "提现记录ID" @Param request body map[string]any true "处理请求 {status, remark}" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Router /admin/invite/withdrawals/{id}/process [post]
func (*InviteHandler) RequestWithdraw ¶
func (h *InviteHandler) RequestWithdraw(c *gin.Context)
RequestWithdraw godoc @Summary 申请提现 @Description 用户申请佣金提现 @Tags 用户端 @Accept json @Produce json @Security BearerAuth @Param request body map[string]any true "提现请求 {amount, method, account, name}" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /user/invite/withdraw [post]
func (*InviteHandler) UpdateConfig ¶
func (h *InviteHandler) UpdateConfig(c *gin.Context)
UpdateConfig godoc @Summary 更新邀请配置 @Description 管理员更新邀请系统配置 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Param request body model.InviteConfig true "Invite configuration" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/invite/config [put]
type KernelAlertsHandler ¶ added in v4.2.0
type KernelAlertsHandler struct {
// contains filtered or unexported fields
}
KernelAlertsHandler lists the kernel's alerts for administrators (certificates that were not renewed, CAs close to their end, phased processes left in a non-final phase; internal/kernelalerts). It is read-only: alerts are raised and resolved by the monitor, and nothing here touches a certificate or a phase.
func NewKernelAlertsHandler ¶ added in v4.2.0
func NewKernelAlertsHandler() *KernelAlertsHandler
NewKernelAlertsHandler reads the kernel database.
func (*KernelAlertsHandler) List ¶ added in v4.2.0
func (h *KernelAlertsHandler) List(c *gin.Context)
List godoc @Summary List the kernel alerts @Description The alerts of the kernel's alert monitor: Agent, forward link and module certificates that were not renewed in time (leaf certificates alert inside the smaller of alerts.leaf_expiry_days and a sixth of their lifetime), the current module and forward link CAs inside alerts.ca_expiry_days, and phased processes left untouched in a non-final phase for alerts.phase_stuck_after (the node credential split, an interrupted finalize, the identity import and cutover). Critical alerts come first, then the soonest to end. The summary counts every active alert whatever the filters. Alerts hold no secret: kinds, node names, dates and counts only. @Tags Kernel @Produce json @Security BearerAuth @Param status query string false "active (default), resolved or all" @Param kind query string false "one alert kind, for example agent_certificate_expiring" @Param severity query string false "warning or critical" @Param limit query int false "1 to 500, default 100" @Success 200 {object} map[string]any "data.alerts and data.summary {active, critical, warning}" @Failure 400 {object} map[string]any @Router /api/v4/kernel/alerts [get]
type KernelHandler ¶
type KernelHandler struct {
// contains filtered or unexported fields
}
func NewKernelHandler ¶
func NewKernelHandler() *KernelHandler
func (*KernelHandler) AddGroupPlan ¶
func (h *KernelHandler) AddGroupPlan(c *gin.Context)
func (*KernelHandler) AddGroupUser ¶
func (h *KernelHandler) AddGroupUser(c *gin.Context)
func (*KernelHandler) ApplyDeployment ¶
func (h *KernelHandler) ApplyDeployment(c *gin.Context)
func (*KernelHandler) CancelOperation ¶
func (h *KernelHandler) CancelOperation(c *gin.Context)
func (*KernelHandler) CreateAccessGroup ¶
func (h *KernelHandler) CreateAccessGroup(c *gin.Context)
func (*KernelHandler) CreateOperation ¶
func (h *KernelHandler) CreateOperation(c *gin.Context)
func (*KernelHandler) CreateResourceGrant ¶
func (h *KernelHandler) CreateResourceGrant(c *gin.Context)
func (*KernelHandler) CreateTopology ¶
func (h *KernelHandler) CreateTopology(c *gin.Context)
func (*KernelHandler) CreateTopologyRevision ¶
func (h *KernelHandler) CreateTopologyRevision(c *gin.Context)
func (*KernelHandler) DeleteAccessGroup ¶
func (h *KernelHandler) DeleteAccessGroup(c *gin.Context)
func (*KernelHandler) DeleteAssignment ¶
func (h *KernelHandler) DeleteAssignment(c *gin.Context)
func (*KernelHandler) DeleteQuotaPolicy ¶
func (h *KernelHandler) DeleteQuotaPolicy(c *gin.Context)
func (*KernelHandler) DeleteResourceGrant ¶
func (h *KernelHandler) DeleteResourceGrant(c *gin.Context)
func (*KernelHandler) DiagnoseTopologyDeployment ¶
func (h *KernelHandler) DiagnoseTopologyDeployment(c *gin.Context)
DiagnoseTopologyDeployment is a semantic alias retained for clients that use the contract's diagnose naming. Both endpoints are strictly read-only.
func (*KernelHandler) ForwardGateway ¶ added in v4.2.0
func (h *KernelHandler) ForwardGateway(c *gin.Context)
ForwardGateway serves /api/v4/forward/*.
func (*KernelHandler) ForwardLegacyArchive ¶ added in v4.2.0
func (h *KernelHandler) ForwardLegacyArchive(c *gin.Context)
ForwardLegacyArchive serves the newest recorded archive to a super administrator, and writes every attempt to the audit log.
func (*KernelHandler) GetAccessGroupDetail ¶
func (h *KernelHandler) GetAccessGroupDetail(c *gin.Context)
GetAccessGroupDetail returns the associated identities and policy records needed to safely administer one access group. The underlying models stay normalized so the allow-union resolver remains the single authorization implementation rather than a client-side reconstruction.
func (*KernelHandler) GetDeploymentStatus ¶
func (h *KernelHandler) GetDeploymentStatus(c *gin.Context)
func (*KernelHandler) GetPluginInstallationConfiguration ¶
func (h *KernelHandler) GetPluginInstallationConfiguration(c *gin.Context)
func (*KernelHandler) GetPluginReleaseArtifact ¶
func (h *KernelHandler) GetPluginReleaseArtifact(c *gin.Context)
func (*KernelHandler) GetTopologyRevision ¶
func (h *KernelHandler) GetTopologyRevision(c *gin.Context)
func (*KernelHandler) ListAccessGroups ¶
func (h *KernelHandler) ListAccessGroups(c *gin.Context)
func (*KernelHandler) ListAssignments ¶
func (h *KernelHandler) ListAssignments(c *gin.Context)
func (*KernelHandler) ListDeployments ¶
func (h *KernelHandler) ListDeployments(c *gin.Context)
func (*KernelHandler) ListExtensions ¶
func (h *KernelHandler) ListExtensions(c *gin.Context)
func (*KernelHandler) ListObservedStates ¶
func (h *KernelHandler) ListObservedStates(c *gin.Context)
func (*KernelHandler) ListOperations ¶
func (h *KernelHandler) ListOperations(c *gin.Context)
func (*KernelHandler) ListPluginInstallations ¶
func (h *KernelHandler) ListPluginInstallations(c *gin.Context)
func (*KernelHandler) ListPluginReleases ¶
func (h *KernelHandler) ListPluginReleases(c *gin.Context)
func (*KernelHandler) ListPlugins ¶
func (h *KernelHandler) ListPlugins(c *gin.Context)
func (*KernelHandler) ListQuotaPolicies ¶
func (h *KernelHandler) ListQuotaPolicies(c *gin.Context)
func (*KernelHandler) ListResourceGrants ¶
func (h *KernelHandler) ListResourceGrants(c *gin.Context)
func (*KernelHandler) ListServiceScopes ¶
func (h *KernelHandler) ListServiceScopes(c *gin.Context)
func (*KernelHandler) ListTopologies ¶
func (h *KernelHandler) ListTopologies(c *gin.Context)
func (*KernelHandler) ListTopologyRevisions ¶
func (h *KernelHandler) ListTopologyRevisions(c *gin.Context)
func (*KernelHandler) PlanDeployment ¶
func (h *KernelHandler) PlanDeployment(c *gin.Context)
func (*KernelHandler) PluginInstallationAction ¶
func (h *KernelHandler) PluginInstallationAction(c *gin.Context)
func (*KernelHandler) PluginRouteGateway ¶
func (h *KernelHandler) PluginRouteGateway(c *gin.Context)
func (*KernelHandler) PreviewDeployment ¶
func (h *KernelHandler) PreviewDeployment(c *gin.Context)
PreviewDeployment is the body-addressed variant used by automation that has not yet selected a nested topology route.
func (*KernelHandler) PreviewTopologyDeployment ¶
func (h *KernelHandler) PreviewTopologyDeployment(c *gin.Context)
PreviewTopologyDeployment runs the read-only topology preflight. It returns HTTP 200 with valid=false and structured issues for an invalid graph so the editor can render all problems in one request; only missing database rows are transport errors.
func (*KernelHandler) RegisterPluginRelease ¶
func (h *KernelHandler) RegisterPluginRelease(c *gin.Context)
func (*KernelHandler) RemoveGroupPlan ¶
func (h *KernelHandler) RemoveGroupPlan(c *gin.Context)
func (*KernelHandler) RemoveGroupUser ¶
func (h *KernelHandler) RemoveGroupUser(c *gin.Context)
func (*KernelHandler) ResolveAccess ¶
func (h *KernelHandler) ResolveAccess(c *gin.Context)
func (*KernelHandler) RollbackDeployment ¶
func (h *KernelHandler) RollbackDeployment(c *gin.Context)
func (*KernelHandler) ServeAgentPluginArtifact ¶
func (h *KernelHandler) ServeAgentPluginArtifact(c *gin.Context)
func (*KernelHandler) ServeAgentPluginManifest ¶
func (h *KernelHandler) ServeAgentPluginManifest(c *gin.Context)
func (*KernelHandler) ServePluginWebUIAsset ¶
func (h *KernelHandler) ServePluginWebUIAsset(c *gin.Context)
func (*KernelHandler) UpdateAccessGroup ¶
func (h *KernelHandler) UpdateAccessGroup(c *gin.Context)
func (*KernelHandler) UpdatePluginInstallationConfiguration ¶
func (h *KernelHandler) UpdatePluginInstallationConfiguration(c *gin.Context)
func (*KernelHandler) UploadPluginReleaseArtifact ¶
func (h *KernelHandler) UploadPluginReleaseArtifact(c *gin.Context)
func (*KernelHandler) UpsertAssignment ¶
func (h *KernelHandler) UpsertAssignment(c *gin.Context)
func (*KernelHandler) UpsertPluginInstallation ¶
func (h *KernelHandler) UpsertPluginInstallation(c *gin.Context)
func (*KernelHandler) UpsertQuotaPolicy ¶
func (h *KernelHandler) UpsertQuotaPolicy(c *gin.Context)
func (*KernelHandler) ValidateTopology ¶
func (h *KernelHandler) ValidateTopology(c *gin.Context)
type KernelNodeOperationsHandler ¶ added in v4.1.0
type KernelNodeOperationsHandler struct {
// contains filtered or unexported fields
}
KernelNodeOperationsHandler lists the KernelNodeOps ledger for administrators (docs/architecture/node-ops-service.md section 3.9). It is read-only.
func NewKernelNodeOperationsHandler ¶ added in v4.1.0
func NewKernelNodeOperationsHandler() *KernelNodeOperationsHandler
NewKernelNodeOperationsHandler reads the kernel database.
func (*KernelNodeOperationsHandler) List ¶ added in v4.1.0
func (h *KernelNodeOperationsHandler) List(c *gin.Context)
List answers GET /api/v4/kernel/node-operations: every package's node operations, newest first, filtered by package_id, family, kind, state, request_id, operation_id, parent_operation_id, or target_kind with target_id, and paged by before (a cursor) and limit (at most 500).
type KernelNotificationsHandler ¶ added in v4.2.0
type KernelNotificationsHandler struct {
// contains filtered or unexported fields
}
KernelNotificationsHandler serves the kernel's notification checks.
func NewKernelNotificationsHandler ¶ added in v4.2.0
func NewKernelNotificationsHandler() *KernelNotificationsHandler
NewKernelNotificationsHandler builds the handler over the process database.
func (*KernelNotificationsHandler) TelegramTest ¶ added in v4.2.0
func (h *KernelNotificationsHandler) TelegramTest(c *gin.Context)
TelegramTest godoc @Summary Send a test message through the Telegram bot @Description Sends one fixed test message through the bot configured in the Telegram bot settings (the v2_telegram_bot row) and answers the result class: ok, invalid_token, chat_not_found, bot_blocked, rate_limited, not_configured, network_error (with a reason: timeout, dns, tls, connect, canceled, other) or unknown. The answer never carries the bot token, a URL or Telegram's own text. The message goes to the calling administrator's own bound Telegram chat; an explicit chat_id is accepted only when it is that chat or one of the bot's admin_ids. An administrator without a bound Telegram account gets 409. At most 5 tests a minute per administrator and 20 in ten minutes for all of them (429 with Retry-After). Every attempt is recorded in the operation log (module notification, action telegram_test) with its class only. @Tags Kernel @Accept json @Produce json @Security BearerAuth @Param request body telegramTestRequest false "chat_id (optional)" @Success 200 {object} map[string]any "data.class, data.ok, data.message, data.target, data.error_code, data.reason" @Failure 400 {object} map[string]any @Failure 403 {object} map[string]any @Failure 409 {object} map[string]any @Failure 429 {object} map[string]any @Router /api/v4/kernel/notifications/telegram/test [post]
type KnowledgeHandler ¶
type KnowledgeHandler struct{}
KnowledgeHandler 用户端知识库处理器
func NewKnowledgeHandler ¶
func NewKnowledgeHandler() *KnowledgeHandler
NewKnowledgeHandler 创建知识库处理器
func (*KnowledgeHandler) GetArticle ¶
func (h *KnowledgeHandler) GetArticle(c *gin.Context)
GetArticle 获取单篇文章详情
func (*KnowledgeHandler) GetArticles ¶
func (h *KnowledgeHandler) GetArticles(c *gin.Context)
GetArticles 获取文章列表 (仅可见且按排序)
type LoadBalancerHandler ¶
type LoadBalancerHandler struct {
// contains filtered or unexported fields
}
LoadBalancerHandler 负载均衡处理器
func NewLoadBalancerHandler ¶
func NewLoadBalancerHandler() *LoadBalancerHandler
NewLoadBalancerHandler 创建处理器
func (*LoadBalancerHandler) CreateLoadBalancer ¶
func (h *LoadBalancerHandler) CreateLoadBalancer(c *gin.Context)
CreateLoadBalancer godoc @Summary 创建负载均衡器 @Description 管理员创建新的负载均衡器 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Param request body model.LoadBalancer true "负载均衡器配置" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/loadbalancers [post]
func (*LoadBalancerHandler) DeleteLoadBalancer ¶
func (h *LoadBalancerHandler) DeleteLoadBalancer(c *gin.Context)
DeleteLoadBalancer godoc @Summary 删除负载均衡器 @Description 管理员删除指定负载均衡器 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Param id path int true "负载均衡器ID" @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/loadbalancers/{id} [delete]
func (*LoadBalancerHandler) GetLoadBalancer ¶
func (h *LoadBalancerHandler) GetLoadBalancer(c *gin.Context)
GetLoadBalancer godoc @Summary 获取负载均衡器详情 @Description 管理员获取指定负载均衡器的详细信息 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Param id path int true "负载均衡器ID" @Success 200 {object} map[string]any @Failure 404 {object} map[string]any @Router /admin/loadbalancers/{id} [get]
func (*LoadBalancerHandler) GetLoadBalancerStats ¶
func (h *LoadBalancerHandler) GetLoadBalancerStats(c *gin.Context)
GetLoadBalancerStats godoc @Summary 获取负载均衡统计 @Description 管理员获取指定负载均衡器的统计数据 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Param id path int true "负载均衡器ID" @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/loadbalancers/{id}/stats [get]
func (*LoadBalancerHandler) ListLoadBalancers ¶
func (h *LoadBalancerHandler) ListLoadBalancers(c *gin.Context)
ListLoadBalancers godoc @Summary 获取负载均衡器列表 @Description 管理员获取负载均衡器列表 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Param group_id query int false "分组ID" @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/loadbalancers [get]
func (*LoadBalancerHandler) RunHealthCheck ¶
func (h *LoadBalancerHandler) RunHealthCheck(c *gin.Context)
RunHealthCheck godoc @Summary 执行健康检查 @Description 管理员对指定负载均衡器执行健康检查 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Param id path int true "负载均衡器ID" @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/loadbalancers/{id}/check [post]
func (*LoadBalancerHandler) UpdateLoadBalancer ¶
func (h *LoadBalancerHandler) UpdateLoadBalancer(c *gin.Context)
UpdateLoadBalancer godoc @Summary 更新负载均衡器 @Description 管理员更新指定负载均衡器的配置 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Param id path int true "负载均衡器ID" @Param request body model.LoadBalancer true "负载均衡器配置" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/loadbalancers/{id} [put]
type MFAHandler ¶
type MFAHandler struct {
// contains filtered or unexported fields
}
MFAHandler handles user and admin MFA endpoints.
func (*MFAHandler) DisableMFA ¶
func (h *MFAHandler) DisableMFA(c *gin.Context)
DisableMFA disables MFA with password confirmation.
func (*MFAHandler) EnableTOTP ¶
func (h *MFAHandler) EnableTOTP(c *gin.Context)
EnableTOTP enables TOTP with verification code.
func (*MFAHandler) GetAdminConfig ¶
func (h *MFAHandler) GetAdminConfig(c *gin.Context)
GetAdminConfig returns global MFA admin config.
func (*MFAHandler) GetStatus ¶
func (h *MFAHandler) GetStatus(c *gin.Context)
GetStatus gets MFA status for current user.
func (*MFAHandler) RegenerateBackupCodes ¶
func (h *MFAHandler) RegenerateBackupCodes(c *gin.Context)
RegenerateBackupCodes regenerates backup codes for current user.
func (*MFAHandler) SetupTOTP ¶
func (h *MFAHandler) SetupTOTP(c *gin.Context)
SetupTOTP sets up TOTP for current user.
func (*MFAHandler) UpdateAdminConfig ¶
func (h *MFAHandler) UpdateAdminConfig(c *gin.Context)
UpdateAdminConfig updates and persists MFA admin config.
func (*MFAHandler) VerifyMFA ¶
func (h *MFAHandler) VerifyMFA(c *gin.Context)
VerifyMFA verifies MFA code.
type MetricsHandler ¶
type MetricsHandler struct {
// contains filtered or unexported fields
}
MetricsHandler Prometheus 指标处理器
func (*MetricsHandler) GetMetrics ¶
func (h *MetricsHandler) GetMetrics(c *gin.Context)
GetMetrics godoc @Summary Prometheus 指标 @Description 获取 Prometheus 格式的系统指标 @Tags 系统 @Produce plain @Success 200 {string} string "Prometheus metrics" @Router /metrics [get]
func (*MetricsHandler) RecordRequest ¶
func (h *MetricsHandler) RecordRequest(success bool)
RecordRequest 记录请求
type ModuleHandler ¶ added in v4.1.0
type ModuleHandler struct {
// contains filtered or unexported fields
}
ModuleHandler administers the module PKI: enrollment credentials for network modules and CA rotation. Routes sit behind admin authentication and the audit log.
func NewModuleHandler ¶ added in v4.1.0
func NewModuleHandler() *ModuleHandler
NewModuleHandler builds the authority from the loaded configuration on each request, so the handler follows configuration reloads in tests.
func (*ModuleHandler) CreateEnrollment ¶ added in v4.1.0
func (h *ModuleHandler) CreateEnrollment(c *gin.Context)
CreateEnrollment issues an enrollment credential for a module.
func (*ModuleHandler) ListEnrollments ¶ added in v4.1.0
func (h *ModuleHandler) ListEnrollments(c *gin.Context)
ListEnrollments lists enrollment credentials without their secrets.
func (*ModuleHandler) ListRuntimes ¶ added in v4.1.0
func (h *ModuleHandler) ListRuntimes(c *gin.Context)
ListRuntimes lists the packages whose runtime was chosen explicitly; all others run locally.
func (*ModuleHandler) RevokeEnrollment ¶ added in v4.1.0
func (h *ModuleHandler) RevokeEnrollment(c *gin.Context)
RevokeEnrollment revokes a credential and the certificates issued with it.
func (*ModuleHandler) RotateCA ¶ added in v4.1.0
func (h *ModuleHandler) RotateCA(c *gin.Context)
RotateCA creates the next module CA; it signs after one certificate lifetime.
func (*ModuleHandler) SetRuntime ¶ added in v4.1.0
func (h *ModuleHandler) SetRuntime(c *gin.Context)
SetRuntime selects local or remote for a package. It applies at the package's next lifecycle operation.
func (*ModuleHandler) TrustBundle ¶ added in v4.1.0
func (h *ModuleHandler) TrustBundle(c *gin.Context)
TrustBundle returns the module CA bundle as PEM for module deployments.
type MonitorOverview ¶
type MonitorOverview struct {
TotalNodes int64 `json:"total_nodes"`
OnlineNodes int64 `json:"online_nodes"`
OfflineNodes int64 `json:"offline_nodes"`
PendingNodes int64 `json:"pending_nodes"`
TotalUpload int64 `json:"total_upload"`
TotalDownload int64 `json:"total_download"`
}
MonitorOverview 监控概览
type MonitorSnapshot ¶
type MonitorSnapshot struct {
Overview MonitorOverview `json:"overview"`
Nodes []NodeSnapshot `json:"nodes"`
}
MonitorSnapshot 初始快照
type MonitorWSHandler ¶
type MonitorWSHandler struct {
// contains filtered or unexported fields
}
MonitorWSHandler 处理 WebSocket 监控连接
func NewMonitorWSHandler ¶
func NewMonitorWSHandler() *MonitorWSHandler
NewMonitorWSHandler 创建 WebSocket 监控处理器
func (*MonitorWSHandler) HandleMonitorWS ¶
func (h *MonitorWSHandler) HandleMonitorWS(c *gin.Context)
HandleMonitorWS 处理 WebSocket 监控连接 @Summary WebSocket 实时监控 @Description 实时推送节点监控数据 @Tags 管理端-WebSocket @Produce json @Security BearerAuth @Success 101 @Router /admin/ws/monitor [get]
type MonitorWSMessage ¶
type MonitorWSMessage struct {
Type string `json:"type"`
Timestamp int64 `json:"timestamp"`
Data any `json:"data,omitempty"`
Error string `json:"error,omitempty"`
}
MonitorWSMessage WebSocket 监控消息
type NodeDelta ¶
type NodeDelta struct {
ID uint `json:"id"`
Name string `json:"name"`
Status string `json:"status,omitempty"`
CPUUsage float64 `json:"cpu_usage,omitempty"`
MemoryUsage float64 `json:"memory_usage,omitempty"`
DiskUsage float64 `json:"disk_usage,omitempty"`
OnlineUsers int `json:"online_users,omitempty"`
TotalUpload int64 `json:"total_upload,omitempty"`
TotalDownload int64 `json:"total_download,omitempty"`
Uptime int64 `json:"uptime,omitempty"`
ChangedFields []string `json:"changed_fields"`
}
NodeDelta 节点变化
type NodeHandler ¶
type NodeHandler struct {
// contains filtered or unexported fields
}
NodeHandler 节点处理器
func (*NodeHandler) CreateNode ¶
func (h *NodeHandler) CreateNode(c *gin.Context)
CreateNode godoc @Summary 创建节点 @Description 管理员手动创建节点 @Tags 管理端-节点 @Accept json @Produce json @Security BearerAuth @Param request body model.Node true "节点信息" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/nodes [post]
func (*NodeHandler) CreateProtocol ¶
func (h *NodeHandler) CreateProtocol(c *gin.Context)
CreateProtocol godoc @Summary 创建节点协议 @Description 管理员为指定节点创建协议配置 @Tags 管理端-节点 @Accept json @Produce json @Security BearerAuth @Param id path int true "节点ID" @Param request body model.NodeProtocol true "协议配置" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/nodes/{id}/protocols [post]
func (*NodeHandler) DeleteAuthKey ¶
func (h *NodeHandler) DeleteAuthKey(c *gin.Context)
DeleteAuthKey godoc @Summary 删除授权密钥 @Description 管理员删除指定的授权密钥 @Tags 管理端-节点 @Accept json @Produce json @Security BearerAuth @Param id path int true "密钥ID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/auth-keys/{id} [delete]
func (*NodeHandler) DeleteNode ¶
func (h *NodeHandler) DeleteNode(c *gin.Context)
DeleteNode godoc @Summary 删除节点 @Description 管理员删除指定节点 @Tags 管理端-节点 @Accept json @Produce json @Security BearerAuth @Param id path int true "节点ID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/nodes/{id} [delete]
func (*NodeHandler) DeleteProtocol ¶
func (h *NodeHandler) DeleteProtocol(c *gin.Context)
DeleteProtocol godoc @Summary 删除节点协议 @Description 管理员删除指定的节点协议配置 @Tags 管理端-节点 @Accept json @Produce json @Security BearerAuth @Param protocol_id path int true "协议ID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/nodes/protocols/{protocol_id} [delete]
func (*NodeHandler) DispatchAgentControlOperation ¶
func (h *NodeHandler) DispatchAgentControlOperation(c *gin.Context)
DispatchAgentControlOperation sends a bounded, capability-backed operation.
func (*NodeHandler) GenerateAuthKey ¶
func (h *NodeHandler) GenerateAuthKey(c *gin.Context)
GenerateAuthKey godoc @Summary 生成授权密钥 @Description 管理员生成节点自动注册的授权密钥 @Tags 管理端-节点 @Accept json @Produce json @Security BearerAuth @Param request body map[string]any true "密钥请求 {name, expire_days}" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/auth-keys [post]
func (*NodeHandler) GenerateWireGuardKeypair ¶
func (h *NodeHandler) GenerateWireGuardKeypair(c *gin.Context)
GenerateWireGuardKeypair creates a WireGuard server keypair for the admin protocol form. The private key is returned only to the authenticated caller and is never stored by this endpoint.
func (*NodeHandler) GetAgentControlStatus ¶
func (h *NodeHandler) GetAgentControlStatus(c *gin.Context)
GetAgentControlStatus returns the live v3 control-stream state for one node.
func (*NodeHandler) GetAuthKeys ¶
func (h *NodeHandler) GetAuthKeys(c *gin.Context)
GetAuthKeys godoc @Summary 获取授权密钥列表 @Description 管理员获取所有授权密钥列表。密钥值显示为 ********, 只在生成时返回一次。 @Tags 管理端-节点 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/auth-keys [get]
func (*NodeHandler) GetNode ¶
func (h *NodeHandler) GetNode(c *gin.Context)
GetNode godoc @Summary 获取节点详情 @Description 管理员获取指定节点的详细信息 @Tags 管理端-节点 @Accept json @Produce json @Security BearerAuth @Param id path int true "节点ID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Router /admin/nodes/{id} [get]
func (*NodeHandler) GetNodeCredentials ¶
func (h *NodeHandler) GetNodeCredentials(c *gin.Context)
GetNodeCredentials godoc @Summary 获取节点凭证 @Description 管理员获取指定节点的 api_key / secret, 用于 AnixOps Agent 对接配置。 @Description Node.APIKey/Secret 在普通序列化里是隐藏字段 (json:"-"), 此接口显式返回, @Description 仅限管理员, 供 Ansible 等部署工具自动拉取节点凭证。 @Description 每次读取都写入管理员审计日志 (action "reveal")。 @Tags 管理端-节点 @Accept json @Produce json @Security BearerAuth @Param id path int true "节点ID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Router /admin/nodes/{id}/credentials [get]
func (*NodeHandler) GetNodeLogs ¶
func (h *NodeHandler) GetNodeLogs(c *gin.Context)
GetNodeLogs godoc @Summary 获取节点运行日志 @Description 管理员获取指定节点通过 gRPC 上报的运行日志 @Tags 管理端-节点 @Accept json @Produce json @Security BearerAuth @Param id path int true "节点ID" @Param page query int false "页码" default(1) @Param page_size query int false "每页数量" default(20) @Param level query string false "日志级别" @Param source query string false "日志来源" @Param search query string false "关键词" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/nodes/{id}/logs [get]
func (*NodeHandler) GetNodeRawConfig ¶
func (h *NodeHandler) GetNodeRawConfig(c *gin.Context)
GetNodeRawConfig godoc @Summary 获取节点原始配置 @Description 管理员获取指定节点的原始JSON配置 @Tags 管理端-节点 @Accept json @Produce json @Security BearerAuth @Param id path int true "节点ID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Router /admin/nodes/{id}/raw-config [get]
func (*NodeHandler) GetNodeStats ¶
func (h *NodeHandler) GetNodeStats(c *gin.Context)
GetNodeStats godoc @Summary 获取节点统计 @Description 管理员获取节点统计数据 @Tags 管理端-节点 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/nodes/stats [get]
func (*NodeHandler) GetNodes ¶
func (h *NodeHandler) GetNodes(c *gin.Context)
GetNodes godoc @Summary 获取节点列表 @Description 管理员获取节点列表,支持分页和筛选 @Tags 管理端-节点 @Accept json @Produce json @Security BearerAuth @Param page query int false "页码" default(1) @Param page_size query int false "每页数量" default(20) @Param search query string false "搜索关键词" @Param status query int false "节点状态" @Param group_id query int false "分组ID" @Param sort query string false "排序字段: id, name, host, sort, created_at, last_check_at, cpu_usage, online_users; 缺省为管理员排序 (sort 升序, id 倒序)" Enums(id, name, host, sort, created_at, last_check_at, cpu_usage, online_users) @Param order query string false "排序方向, 仅与 sort 同用" Enums(asc, desc) default(asc) @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/nodes [get]
func (*NodeHandler) GetProtocolTemplates ¶
func (h *NodeHandler) GetProtocolTemplates(c *gin.Context)
GetProtocolTemplates godoc @Summary 获取协议模板 @Description 管理员获取可用的协议模板列表 @Tags 管理端-节点 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Router /admin/protocol-templates [get]
func (*NodeHandler) GetProtocols ¶
func (h *NodeHandler) GetProtocols(c *gin.Context)
GetProtocols godoc @Summary 获取节点协议列表 @Description 管理员获取指定节点的协议配置列表 @Tags 管理端-节点 @Accept json @Produce json @Security BearerAuth @Param id path int true "节点ID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/nodes/{id}/protocols [get]
func (*NodeHandler) Heartbeat ¶
func (h *NodeHandler) Heartbeat(c *gin.Context)
Heartbeat godoc @Summary 节点心跳 @Description 节点向面板发送心跳以保持在线状态 @Tags 节点通信 @Accept json @Produce json @Security BearerAuth @Param request body model.NodeHeartbeatRequest true "心跳请求" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 401 {object} map[string]any @Failure 500 {object} map[string]any @Router /node/heartbeat [post]
func (*NodeHandler) InternalGenerateAuthKey ¶
func (h *NodeHandler) InternalGenerateAuthKey(c *gin.Context)
InternalGenerateAuthKey godoc @Summary 内部生成授权密钥 @Description 使用API Token认证生成节点自动注册的授权密钥(供Ansible等自动化工具使用) @Tags 内部API @Accept json @Produce json @Security ApiTokenAuth @Param request body map[string]any true "密钥请求 {name, expire_days, node_name}" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /internal/auth-keys [post]
func (*NodeHandler) Register ¶
func (h *NodeHandler) Register(c *gin.Context)
Register godoc @Summary 节点自动注册 @Description 节点通过授权密钥自动注册到面板 @Tags 节点通信 @Accept json @Produce json @Param request body model.NodeRegisterRequest true "注册请求" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /node/register [post]
func (*NodeHandler) RuntimeHealth ¶
func (h *NodeHandler) RuntimeHealth(c *gin.Context)
RuntimeHealth godoc @Summary 上报节点运行时健康状态 @Description 节点上报 WireGuard/GOST 等托管运行时的进程健康状态,不覆盖普通心跳状态 @Tags 节点通信 @Accept json @Produce json @Security BearerAuth @Param request body model.NodeRuntimeHealthRequest true "运行时健康状态" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 401 {object} map[string]any @Failure 404 {object} map[string]any @Failure 500 {object} map[string]any @Router /node/runtime-health [post]
func (*NodeHandler) SyncProtocol ¶
func (h *NodeHandler) SyncProtocol(c *gin.Context)
SyncProtocol godoc @Summary 同步协议到节点 @Description 管理员将协议配置同步到指定节点 @Tags 管理端-节点 @Accept json @Produce json @Security BearerAuth @Param id path int true "节点ID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/nodes/{id}/sync [post]
func (*NodeHandler) UpdateNode ¶
func (h *NodeHandler) UpdateNode(c *gin.Context)
UpdateNode godoc @Summary 更新节点 @Description 管理员更新指定节点的信息 @Tags 管理端-节点 @Accept json @Produce json @Security BearerAuth @Param id path int true "节点ID" @Param request body map[string]any true "节点更新信息" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/nodes/{id} [put]
func (*NodeHandler) UpdateNodeRawConfig ¶
func (h *NodeHandler) UpdateNodeRawConfig(c *gin.Context)
UpdateNodeRawConfig godoc @Summary 更新节点原始配置 @Description 管理员更新指定节点的原始JSON配置(高级模式) @Tags 管理端-节点 @Accept json @Produce json @Security BearerAuth @Param id path int true "节点ID" @Param request body map[string]any true "原始配置 {raw_config: object}" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/nodes/{id}/raw-config [put]
func (*NodeHandler) UpdateProtocol ¶
func (h *NodeHandler) UpdateProtocol(c *gin.Context)
UpdateProtocol godoc @Summary 更新节点协议 @Description 管理员更新指定的节点协议配置 @Tags 管理端-节点 @Accept json @Produce json @Security BearerAuth @Param protocol_id path int true "协议ID" @Param request body map[string]any true "协议更新信息" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/nodes/protocols/{protocol_id} [put]
func (*NodeHandler) ValidateRawConfig ¶
func (h *NodeHandler) ValidateRawConfig(c *gin.Context)
ValidateRawConfig godoc @Summary 验证原始配置 @Description 管理员验证节点原始JSON配置的有效性 @Tags 管理端-节点 @Accept json @Produce json @Security BearerAuth @Param request body map[string]any true "原始配置 {raw_config: object}" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /admin/nodes/validate-config [post]
type NodeSnapshot ¶
type NodeSnapshot struct {
ID uint `json:"id"`
Name string `json:"name"`
Host string `json:"host"`
Status string `json:"status"`
CPUUsage float64 `json:"cpu_usage"`
MemoryUsage float64 `json:"memory_usage"`
DiskUsage float64 `json:"disk_usage"`
OnlineUsers int `json:"online_users"`
TotalUpload int64 `json:"total_upload"`
TotalDownload int64 `json:"total_download"`
Uptime int64 `json:"uptime"`
}
NodeSnapshot 节点快照
type NodeTrafficHandler ¶ added in v4.2.0
type NodeTrafficHandler struct {
// contains filtered or unexported fields
}
NodeTrafficHandler serves a proxy node's traffic series for the admin charts: hourly buckets from the raw traffic log and daily buckets from the daily server statistics. It reads the tables the traffic reports already write and keeps none of its own.
func NewNodeTrafficHandler ¶ added in v4.2.0
func NewNodeTrafficHandler() *NodeTrafficHandler
NewNodeTrafficHandler reads the kernel database on each request.
func (*NodeTrafficHandler) Get ¶ added in v4.2.0
func (h *NodeTrafficHandler) Get(c *gin.Context)
Get godoc @Summary Proxy node traffic series @Description One proxy node's traffic over time for the admin charts, ascending, buckets without traffic as zeros. granularity=hour (the default) sums the node's rows of the raw traffic log v2_server_log in UTC hours: the last 24 hours by default, at most 720 hourly buckets, and only as far back as the operator keeps the raw log (docs/reference/traffic-stats-operations.md). granularity=day reads the node's daily server statistics (v2_stat_server): the last 30 days by default, at most 366 daily buckets, aligned to the Control host's local midnight, kept regardless of the raw log's retention. since and until are Unix milliseconds (since inclusive, until exclusive); they are rounded out to whole buckets, and the answer's since_unix_ms and until_unix_ms are the window actually returned. Bytes are the panel's metered bytes: up and down with the node's traffic rate applied, as /api/v2/admin/traffic/hourly counts them, summed over every protocol the node reported under. This is the proxy node's user traffic; forwarding traffic is /api/v4/forward/stats and /api/v4/forward/routes/{id}/stats. @Tags Kernel @Produce json @Security BearerAuth @Param id path int true "proxy node id" @Param granularity query string false "hour (default) or day" @Param since query int false "window start, Unix milliseconds" @Param until query int false "window end (exclusive), Unix milliseconds" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Router /api/v4/kernel/nodes/{id}/traffic [get]
type NotificationHandler ¶
type NotificationHandler struct {
// contains filtered or unexported fields
}
NotificationHandler 通知处理器
func NewNotificationHandler ¶
func NewNotificationHandler() *NotificationHandler
NewNotificationHandler 创建处理器
func (*NotificationHandler) CreateTemplate ¶
func (h *NotificationHandler) CreateTemplate(c *gin.Context)
CreateTemplate godoc @Summary 创建通知模板 @Description 管理员创建新的通知模板 @Tags 管理端-通知 @Accept json @Produce json @Security BearerAuth @Param request body map[string]any true "模板信息" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/notification/templates [post]
func (*NotificationHandler) DeleteTemplate ¶
func (h *NotificationHandler) DeleteTemplate(c *gin.Context)
DeleteTemplate godoc @Summary 删除通知模板 @Description 管理员删除指定通知模板 @Tags 管理端-通知 @Accept json @Produce json @Security BearerAuth @Param id path int true "模板ID" @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/notification/templates/{id} [delete]
func (*NotificationHandler) GetEmailConfig ¶
func (h *NotificationHandler) GetEmailConfig(c *gin.Context)
GetEmailConfig godoc @Summary 获取邮件配置 @Description 管理员获取邮件发送配置 @Tags 管理端-通知 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Router /admin/notification/email/config [get]
func (*NotificationHandler) GetUnreadCount ¶
func (h *NotificationHandler) GetUnreadCount(c *gin.Context)
GetUnreadCount godoc @Summary 获取未读通知数量 @Description 用户获取未读通知的数量 @Tags 用户端 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Router /user/notifications/unread-count [get]
func (*NotificationHandler) GetUserNotifications ¶
func (h *NotificationHandler) GetUserNotifications(c *gin.Context)
GetUserNotifications godoc @Summary 获取用户通知列表 @Description 用户获取自己的通知列表 @Tags 用户端 @Accept json @Produce json @Security BearerAuth @Param page query int false "页码" default(1) @Param page_size query int false "每页数量" default(20) @Success 200 {object} map[string]any @Router /user/notifications [get]
func (*NotificationHandler) ListLogs ¶
func (h *NotificationHandler) ListLogs(c *gin.Context)
ListLogs godoc @Summary 获取通知日志列表 @Description 管理员获取通知日志列表 @Tags 管理端-通知 @Accept json @Produce json @Security BearerAuth @Param page query int false "页码" default(1) @Param page_size query int false "每页数量" default(20) @Param type query string false "通知类型" @Param status query string false "发送状态" @Success 200 {object} map[string]any @Router /admin/notification/logs [get]
func (*NotificationHandler) ListTemplates ¶
func (h *NotificationHandler) ListTemplates(c *gin.Context)
ListTemplates godoc @Summary 获取通知模板列表 @Description 管理员获取通知模板列表 @Tags 管理端-通知 @Accept json @Produce json @Security BearerAuth @Param type query string false "通知类型" @Success 200 {object} map[string]any @Router /admin/notification/templates [get]
func (*NotificationHandler) MarkAllAsRead ¶
func (h *NotificationHandler) MarkAllAsRead(c *gin.Context)
MarkAllAsRead godoc @Summary 标记所有通知为已读 @Description 用户将所有通知标记为已读 @Tags 用户端 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Router /user/notifications/read-all [post]
func (*NotificationHandler) MarkAsRead ¶
func (h *NotificationHandler) MarkAsRead(c *gin.Context)
MarkAsRead godoc @Summary 标记通知为已读 @Description 用户将指定通知标记为已读 @Tags 用户端 @Accept json @Produce json @Security BearerAuth @Param id path int true "通知ID" @Success 200 {object} map[string]any @Failure 404 {object} map[string]any @Router /user/notifications/{id}/read [post]
func (*NotificationHandler) SendTestNotification ¶
func (h *NotificationHandler) SendTestNotification(c *gin.Context)
SendTestNotification godoc @Summary 发送测试通知 @Description 管理员发送测试通知 @Tags 管理端-通知 @Accept json @Produce json @Security BearerAuth @Param request body map[string]any true "测试通知请求" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/notification/test [post]
func (*NotificationHandler) UpdateEmailConfig ¶
func (h *NotificationHandler) UpdateEmailConfig(c *gin.Context)
UpdateEmailConfig godoc @Summary 更新邮件配置 @Description 管理员更新邮件发送配置 @Tags 管理端-通知 @Accept json @Produce json @Security BearerAuth @Param request body map[string]any true "邮件配置" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /admin/notification/email/config [put]
func (*NotificationHandler) UpdateTemplate ¶
func (h *NotificationHandler) UpdateTemplate(c *gin.Context)
UpdateTemplate godoc @Summary 更新通知模板 @Description 管理员更新指定通知模板 @Tags 管理端-通知 @Accept json @Produce json @Security BearerAuth @Param id path int true "模板ID" @Param request body map[string]any true "模板更新信息" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/notification/templates/{id} [put]
type NotifySettingsRequest ¶
type NotifySettingsRequest struct {
NotifyExpire *bool `json:"notify_expire"`
NotifyTraffic *bool `json:"notify_traffic"`
NotifyTicket *bool `json:"notify_ticket"`
}
NotifySettingsRequest 通知设置请求
type OrderHandler ¶
type OrderHandler struct {
// contains filtered or unexported fields
}
OrderHandler 用户端订单处理器
func (*OrderHandler) GetOrderDetail ¶
func (h *OrderHandler) GetOrderDetail(c *gin.Context)
GetOrderDetail 获取订单详情: the caller's own order with its plan's id and name. Another user's order is "not found", as an unknown one.
func (*OrderHandler) GetOrders ¶
func (h *OrderHandler) GetOrders(c *gin.Context)
GetOrders 获取用户自己的订单: each with its plan's id and name, none with the buyer. The page size is clamped as on the administrator's list.
func (*OrderHandler) SaveOrder ¶
func (h *OrderHandler) SaveOrder(c *gin.Context)
SaveOrder 保存订单 (下单)
type PaymentGatewayHandler ¶
type PaymentGatewayHandler struct {
// contains filtered or unexported fields
}
PaymentGatewayHandler 支付网关处理器
func NewPaymentGatewayHandler ¶
func NewPaymentGatewayHandler() *PaymentGatewayHandler
NewPaymentGatewayHandler 创建处理器
func (*PaymentGatewayHandler) CreateGateway ¶
func (h *PaymentGatewayHandler) CreateGateway(c *gin.Context)
CreateGateway godoc @Summary 创建支付网关 @Description 管理员创建新的支付网关 @Tags 管理端-支付 @Accept json @Produce json @Security BearerAuth @Param request body CreateGatewayRequest true "网关信息" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/payment/gateways [post]
func (*PaymentGatewayHandler) CreatePayment ¶
func (h *PaymentGatewayHandler) CreatePayment(c *gin.Context)
CreatePayment godoc @Summary 创建支付订单 @Description 用户创建支付订单 @Tags 用户端 @Accept json @Produce json @Security BearerAuth @Param request body CreatePaymentRequest true "支付请求" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /user/payment/create [post]
func (*PaymentGatewayHandler) DeleteGateway ¶
func (h *PaymentGatewayHandler) DeleteGateway(c *gin.Context)
DeleteGateway godoc @Summary 删除支付网关 @Description 管理员删除指定支付网关 @Tags 管理端-支付 @Accept json @Produce json @Security BearerAuth @Param id path int true "网关ID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/payment/gateways/{id} [delete]
func (*PaymentGatewayHandler) GetChannels ¶
func (h *PaymentGatewayHandler) GetChannels(c *gin.Context)
GetChannels godoc @Summary 获取支付渠道列表 @Description 用户获取可用的支付渠道列表 @Tags 用户端 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /user/payment/channels [get]
func (*PaymentGatewayHandler) GetPaymentStats ¶
func (h *PaymentGatewayHandler) GetPaymentStats(c *gin.Context)
GetPaymentStats godoc @Summary 获取支付统计 @Description 管理员获取支付统计数据,支持日期范围筛选 @Tags 管理端-支付 @Accept json @Produce json @Security BearerAuth @Param start query string false "开始日期 (格式: 2006-01-02)" @Param end query string false "结束日期 (格式: 2006-01-02)" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/payment/stats [get]
func (*PaymentGatewayHandler) GetPaymentStatus ¶
func (h *PaymentGatewayHandler) GetPaymentStatus(c *gin.Context)
GetPaymentStatus godoc @Summary 查询支付状态 @Description 用户查询支付订单状态 @Tags 用户端 @Accept json @Produce json @Security BearerAuth @Param trade_no path string true "订单号" @Success 200 {object} map[string]any @Failure 404 {object} map[string]any @Router /user/payment/status/{trade_no} [get]
func (*PaymentGatewayHandler) GetUserRecords ¶
func (h *PaymentGatewayHandler) GetUserRecords(c *gin.Context)
GetUserRecords godoc @Summary 获取用户支付记录 @Description 用户获取自己的支付记录列表 @Tags 用户端 @Accept json @Produce json @Security BearerAuth @Param page query int false "页码" default(1) @Param page_size query int false "每页数量" default(20) @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /user/payment/records [get]
func (*PaymentGatewayHandler) ListGateways ¶
func (h *PaymentGatewayHandler) ListGateways(c *gin.Context)
ListGateways godoc @Summary 获取支付网关列表 @Description 管理员获取所有支付网关列表 @Tags 管理端-支付 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/payment/gateways [get]
func (*PaymentGatewayHandler) ListPaymentRecords ¶
func (h *PaymentGatewayHandler) ListPaymentRecords(c *gin.Context)
ListPaymentRecords godoc @Summary 获取支付记录列表 @Description 管理员获取支付记录列表,支持分页和状态筛选 @Tags 管理端-支付 @Accept json @Produce json @Security BearerAuth @Param page query int false "页码" default(1) @Param page_size query int false "每页数量" default(20) @Param status query int false "支付状态" @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/payment/records [get]
func (*PaymentGatewayHandler) PaymentCallback ¶
func (h *PaymentGatewayHandler) PaymentCallback(c *gin.Context)
PaymentCallback godoc @Summary 支付回调 @Description 接收第三方支付平台的回调通知 @Tags 支付回调 @Accept json @Produce plain @Param type path string true "支付类型 (alipay/wechat/epay等)" @Success 200 {string} string "success" @Failure 400 {string} string "fail" @Router /payment/callback/{type} [post]
func (*PaymentGatewayHandler) ToggleGateway ¶
func (h *PaymentGatewayHandler) ToggleGateway(c *gin.Context)
ToggleGateway godoc @Summary 切换网关状态 @Description 管理员启用或禁用指定支付网关 @Tags 管理端-支付 @Accept json @Produce json @Security BearerAuth @Param id path int true "网关ID" @Param request body ToggleRequest true "状态请求" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/payment/gateways/{id}/toggle [post]
func (*PaymentGatewayHandler) UpdateGateway ¶
func (h *PaymentGatewayHandler) UpdateGateway(c *gin.Context)
UpdateGateway godoc @Summary 更新支付网关 @Description 管理员更新指定支付网关的信息 @Tags 管理端-支付 @Accept json @Produce json @Security BearerAuth @Param id path int true "网关ID" @Param request body UpdateGatewayRequest true "网关更新信息" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/payment/gateways/{id} [put]
type PaymentHandler ¶
type PaymentHandler struct {
// contains filtered or unexported fields
}
PaymentHandler 支付处理器
func (*PaymentHandler) FiatCreatePayment ¶
func (h *PaymentHandler) FiatCreatePayment(c *gin.Context)
FiatCreatePayment 创建法币支付
The order is validated as before. A request for Stripe or PayPal is then refused: neither provider's checkout is implemented, and an earlier version answered a simulated checkout link and stored a pending payment record that nothing could ever pay.
func (*PaymentHandler) GetPaymentMethods ¶
func (h *PaymentHandler) GetPaymentMethods(c *gin.Context)
GetPaymentMethods 获取可用支付方式
func (*PaymentHandler) GetPaymentStatus ¶
func (h *PaymentHandler) GetPaymentStatus(c *gin.Context)
GetPaymentStatus 查询支付状态
func (*PaymentHandler) PayPalWebhook ¶
func (h *PaymentHandler) PayPalWebhook(c *gin.Context)
PayPalWebhook PayPal 回调
func (*PaymentHandler) StripeWebhook ¶
func (h *PaymentHandler) StripeWebhook(c *gin.Context)
StripeWebhook Stripe 回调
func (*PaymentHandler) X402Callback ¶
func (h *PaymentHandler) X402Callback(c *gin.Context)
X402Callback X402 支付回调
func (*PaymentHandler) X402CheckPayment ¶
func (h *PaymentHandler) X402CheckPayment(c *gin.Context)
X402CheckPayment 查询 X402 支付状态
func (*PaymentHandler) X402CreatePayment ¶
func (h *PaymentHandler) X402CreatePayment(c *gin.Context)
X402CreatePayment 创建 X402 支付
type PublicConfig ¶ added in v4.1.0
type PublicConfig struct {
Edition string `json:"edition"`
HiddenPackages []string `json:"hidden_packages"`
Registration PublicRegistrationConfig `json:"registration"`
}
PublicConfig is what the web app reads before anyone signs in: the product edition, the packages the edition hides (their menus and pages are not shown), and whether registration asks for an invite code.
func NewPublicConfig ¶ added in v4.1.0
func NewPublicConfig(cfg *config.Config) PublicConfig
NewPublicConfig returns the public configuration of cfg.
type PublicRegistrationConfig ¶ added in v4.1.0
type PublicRegistrationConfig struct {
Enabled bool `json:"enabled"`
RequireInvite bool `json:"require_invite"`
}
PublicRegistrationConfig is the public part of the registration policy.
type RouteModeChangeBody ¶ added in v4.1.0
type RouteModeChangeBody struct {
PackageID string `json:"package_id" binding:"required"`
Routes []string `json:"routes"`
Mode string `json:"mode" binding:"required"`
Reason string `json:"reason"`
Confirm bool `json:"confirm"`
}
RouteModeChangeBody switches routes of a package. No routes means the whole package. Switching to native needs confirm and a reason.
type RouteModeHandler ¶ added in v4.1.0
type RouteModeHandler struct {
// contains filtered or unexported fields
}
RouteModeHandler lists and switches the route modes of v2 Control packages (legacy, shadow, native). Any administrator may read them; only a super administrator (service.IsSuperAdmin) may switch them.
func NewRouteModeHandler ¶ added in v4.1.0
func NewRouteModeHandler() *RouteModeHandler
NewRouteModeHandler reads the database, the official package trust root and the package hosts' reports on each request.
func (*RouteModeHandler) List ¶ added in v4.1.0
func (h *RouteModeHandler) List(c *gin.Context)
List godoc @Summary List package route modes @Description Every v2 Control package's compatibility routes with their configured and effective mode, the modes each may switch to, the running host's native and shadow counters with the mismatch rate, and how many sanitized shadow mismatch samples are stored. can_switch tells whether the caller may switch them. @Tags Kernel route modes @Produce json @Security BearerAuth @Param package_id query string false "Package id" @Success 200 {object} map[string]any @Failure 404 {object} map[string]any @Router /api/v4/kernel/route-modes [get]
func (*RouteModeHandler) Mismatches ¶ added in v4.1.0
func (h *RouteModeHandler) Mismatches(c *gin.Context)
Mismatches godoc @Summary List shadow mismatch samples @Description The newest sanitized shadow-mode mismatch samples, of one package or route or of all: the route, method, path template with masked query values, legacy and native status, and a structural diff whose values are masked (tokens, passwords, UUIDs, keys and other secrets fully; e-mail addresses keep their first character and domain, IPv4 addresses two octets, IPv6 addresses two hextets). Samples are kept for 7 days and at most 100 per route. Any administrator may read them. @Tags Kernel route modes @Produce json @Security BearerAuth @Param package_id query string false "Package id" @Param route_id query string false "Route id" @Param limit query int false "At most this many samples (default 50, at most 100)" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /api/v4/kernel/route-modes/mismatches [get]
func (*RouteModeHandler) Revisions ¶ added in v4.1.0
func (h *RouteModeHandler) Revisions(c *gin.Context)
Revisions godoc @Summary List route mode revisions @Description The latest route mode switches, newest first, of one package or of all. @Tags Kernel route modes @Produce json @Security BearerAuth @Param package_id query string false "Package id" @Param limit query int false "At most this many revisions (default 100, at most 1000)" @Success 200 {object} map[string]any @Router /api/v4/kernel/route-modes/revisions [get]
func (*RouteModeHandler) Rollback ¶ added in v4.1.0
func (h *RouteModeHandler) Rollback(c *gin.Context)
Rollback godoc @Summary Roll a package back to legacy route modes @Description Returns every route of a package to legacy in one change, except identity group A, which the identity rollback switches. Super administrators only; no confirmation is needed and the reason is optional. @Tags Kernel route modes @Accept json @Produce json @Security BearerAuth @Param body body RouteModeRollbackBody true "Rollback" @Success 200 {object} map[string]any @Failure 403 {object} map[string]any @Failure 404 {object} map[string]any @Router /api/v4/kernel/route-modes/rollback [post]
func (*RouteModeHandler) Set ¶ added in v4.1.0
func (h *RouteModeHandler) Set(c *gin.Context)
Set godoc @Summary Switch package route modes @Description Switches the named routes of a package, or every route that may switch, to legacy, shadow or native. Super administrators only. Switching to native needs confirm: true and a reason. Every switch is audited and recorded in the revision history. @Tags Kernel route modes @Accept json @Produce json @Security BearerAuth @Param body body RouteModeChangeBody true "Route mode change" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 403 {object} map[string]any @Failure 404 {object} map[string]any @Failure 409 {object} map[string]any @Router /api/v4/kernel/route-modes [post]
type RouteModeRollbackBody ¶ added in v4.1.0
type RouteModeRollbackBody struct {
PackageID string `json:"package_id" binding:"required"`
Reason string `json:"reason"`
}
RouteModeRollbackBody returns a whole package to legacy.
type SendNotificationRequest ¶
type SendNotificationRequest struct {
TelegramID int64 `json:"telegram_id" binding:"required"`
Title string `json:"title" binding:"omitempty,max=255"`
Content string `json:"content" binding:"omitempty,max=4096"`
Message string `json:"message" binding:"omitempty,max=4096"`
}
SendNotificationRequest 发送通知请求
type SetWebhookRequest ¶
type SetWebhookRequest struct {
URL string `json:"url" binding:"omitempty,url,max=512"`
}
SetWebhookRequest 设置Webhook请求
type SpeedLimitHandler ¶
type SpeedLimitHandler struct {
// contains filtered or unexported fields
}
func NewSpeedLimitHandler ¶
func NewSpeedLimitHandler() *SpeedLimitHandler
func (*SpeedLimitHandler) CreatePanelSpeedLimit ¶
func (h *SpeedLimitHandler) CreatePanelSpeedLimit(c *gin.Context)
func (*SpeedLimitHandler) DeletePanelSpeedLimit ¶
func (h *SpeedLimitHandler) DeletePanelSpeedLimit(c *gin.Context)
func (*SpeedLimitHandler) ListPanelSpeedLimitTunnels ¶
func (h *SpeedLimitHandler) ListPanelSpeedLimitTunnels(c *gin.Context)
func (*SpeedLimitHandler) ListPanelSpeedLimits ¶
func (h *SpeedLimitHandler) ListPanelSpeedLimits(c *gin.Context)
type SubscribeHandler ¶
type SubscribeHandler struct {
// contains filtered or unexported fields
}
SubscribeHandler 订阅处理器
func NewSubscribeHandler ¶
func NewSubscribeHandler(cfg *config.Config) *SubscribeHandler
NewSubscribeHandler 创建订阅处理器
func (*SubscribeHandler) GetLegacySubscription ¶
func (h *SubscribeHandler) GetLegacySubscription(c *gin.Context)
GetLegacySubscription keeps compatibility with the historical /api/v1/client/subscribe?token=TOKEN entrypoint.
func (*SubscribeHandler) GetSubscription ¶
func (h *SubscribeHandler) GetSubscription(c *gin.Context)
GetSubscription 获取用户订阅 GET /s/:token 支持 URL 参数:
- type: 指定输出格式 (v2ray, clash, stash, egern, surge, loon, shadowrocket, quantumultx, json, base64json, wireguard) 也支持 type=auto 或 type=ua,强制按 User-Agent 自动识别格式
- include: 包含节点名关键词 (正则)
- exclude: 排除节点名关键词 (正则)
- groups: 指定分组 ID (逗号分隔)
type SubscriptionAdminHandler ¶
type SubscriptionAdminHandler struct {
// contains filtered or unexported fields
}
SubscriptionAdminHandler 订阅管理处理器
func NewSubscriptionAdminHandler ¶
func NewSubscriptionAdminHandler() *SubscriptionAdminHandler
NewSubscriptionAdminHandler 创建订阅管理处理器
func (*SubscriptionAdminHandler) AssignGroupToPlan ¶
func (h *SubscriptionAdminHandler) AssignGroupToPlan(c *gin.Context)
AssignGroupToPlan 为套餐分配订阅分组 POST /api/v2/admin/subscription/plans/:plan_id/groups
func (*SubscriptionAdminHandler) AssignGroupToUser ¶
func (h *SubscriptionAdminHandler) AssignGroupToUser(c *gin.Context)
AssignGroupToUser 为用户分配订阅分组 POST /api/v2/admin/subscription/users/:user_id/groups
func (*SubscriptionAdminHandler) CreateGroup ¶
func (h *SubscriptionAdminHandler) CreateGroup(c *gin.Context)
CreateGroup 创建订阅分组 POST /api/v2/admin/subscription/groups
func (*SubscriptionAdminHandler) CreateTemplate ¶
func (h *SubscriptionAdminHandler) CreateTemplate(c *gin.Context)
CreateTemplate 创建订阅模板 POST /api/v2/admin/subscription/groups/:id/templates
func (*SubscriptionAdminHandler) DeleteGroup ¶
func (h *SubscriptionAdminHandler) DeleteGroup(c *gin.Context)
DeleteGroup 删除订阅分组 DELETE /api/v2/admin/subscription/groups/:id
func (*SubscriptionAdminHandler) DeleteTemplate ¶
func (h *SubscriptionAdminHandler) DeleteTemplate(c *gin.Context)
DeleteTemplate 删除订阅模板 DELETE /api/v2/admin/subscription/templates/:id
func (*SubscriptionAdminHandler) GetAvailableProtocols ¶
func (h *SubscriptionAdminHandler) GetAvailableProtocols(c *gin.Context)
GetAvailableProtocols 获取所有可用的物理节点协议 (Protocol Pool) GET /api/v2/admin/subscription/protocols/available
func (*SubscriptionAdminHandler) GetGroup ¶
func (h *SubscriptionAdminHandler) GetGroup(c *gin.Context)
GetGroup 获取订阅分组详情 GET /api/v2/admin/subscription/groups/:id
func (*SubscriptionAdminHandler) GetGroupProtocols ¶
func (h *SubscriptionAdminHandler) GetGroupProtocols(c *gin.Context)
GetGroupProtocols 获取属于该分组的物理节点协议 GET /api/v2/admin/subscription/groups/:id/protocols
func (*SubscriptionAdminHandler) GetGroupStats ¶
func (h *SubscriptionAdminHandler) GetGroupStats(c *gin.Context)
GetGroupStats 获取订阅分组统计数据 GET /api/v2/admin/subscription/stats
func (*SubscriptionAdminHandler) GetGroups ¶
func (h *SubscriptionAdminHandler) GetGroups(c *gin.Context)
GetGroups 获取所有订阅分组 GET /api/v2/admin/subscription/groups
func (*SubscriptionAdminHandler) GetPlanGroups ¶
func (h *SubscriptionAdminHandler) GetPlanGroups(c *gin.Context)
GetPlanGroups 获取套餐的订阅分组 GET /api/v2/admin/subscription/plans/:plan_id/groups
func (*SubscriptionAdminHandler) GetProtocolTypes ¶
func (h *SubscriptionAdminHandler) GetProtocolTypes(c *gin.Context)
GetProtocolTypes 获取支持的协议类型 GET /api/v2/admin/subscription/protocols
func (*SubscriptionAdminHandler) GetSubscriptionFormats ¶
func (h *SubscriptionAdminHandler) GetSubscriptionFormats(c *gin.Context)
GetSubscriptionFormats 获取支持的订阅格式 GET /api/v2/admin/subscription/formats
func (*SubscriptionAdminHandler) GetTemplate ¶
func (h *SubscriptionAdminHandler) GetTemplate(c *gin.Context)
GetTemplate 获取订阅模板详情 GET /api/v2/admin/subscription/templates/:id
func (*SubscriptionAdminHandler) GetTemplates ¶
func (h *SubscriptionAdminHandler) GetTemplates(c *gin.Context)
GetTemplates 获取分组的模板列表 GET /api/v2/admin/subscription/groups/:id/templates
func (*SubscriptionAdminHandler) GetUserGroups ¶
func (h *SubscriptionAdminHandler) GetUserGroups(c *gin.Context)
GetUserGroups 获取用户的订阅分组 GET /api/v2/admin/subscription/users/:user_id/groups
func (*SubscriptionAdminHandler) PreviewSubscription ¶
func (h *SubscriptionAdminHandler) PreviewSubscription(c *gin.Context)
PreviewSubscription 预览订阅内容 POST /api/v2/admin/subscription/preview
func (*SubscriptionAdminHandler) RemoveGroupFromPlan ¶
func (h *SubscriptionAdminHandler) RemoveGroupFromPlan(c *gin.Context)
RemoveGroupFromPlan 移除套餐的订阅分组 DELETE /api/v2/admin/subscription/plans/:plan_id/groups/:group_id
func (*SubscriptionAdminHandler) RemoveGroupFromUser ¶
func (h *SubscriptionAdminHandler) RemoveGroupFromUser(c *gin.Context)
RemoveGroupFromUser 移除用户的订阅分组 DELETE /api/v2/admin/subscription/users/:user_id/groups/:group_id
func (*SubscriptionAdminHandler) UpdateGroup ¶
func (h *SubscriptionAdminHandler) UpdateGroup(c *gin.Context)
UpdateGroup 更新订阅分组 PUT /api/v2/admin/subscription/groups/:id
func (*SubscriptionAdminHandler) UpdateGroupProtocols ¶
func (h *SubscriptionAdminHandler) UpdateGroupProtocols(c *gin.Context)
UpdateGroupProtocols 更新分组关联的物理节点协议 POST /api/v2/admin/subscription/groups/:id/protocols
func (*SubscriptionAdminHandler) UpdateTemplate ¶
func (h *SubscriptionAdminHandler) UpdateTemplate(c *gin.Context)
UpdateTemplate 更新订阅模板 PUT /api/v2/admin/subscription/templates/:id
type SystemHandler ¶
type SystemHandler struct {
// contains filtered or unexported fields
}
SystemHandler 系统处理器 SystemHandler handles system configuration, backup, and load balancer endpoints.
func NewSystemHandler ¶
func NewSystemHandler() *SystemHandler
NewSystemHandler 创建处理器 NewSystemHandler creates a system handler.
func (*SystemHandler) CreateBackup ¶
func (h *SystemHandler) CreateBackup(c *gin.Context)
CreateBackup godoc @Summary 创建备份 @Description 管理员手动创建系统备份 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Param type query string false "备份类型 (database/full)" default(database) @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/system/backup [post]
func (*SystemHandler) DeleteBackup ¶
func (h *SystemHandler) DeleteBackup(c *gin.Context)
DeleteBackup godoc @Summary 删除备份 @Description 管理员删除指定备份记录 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Param id path int true "备份ID" @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/system/backups/{id} [delete]
func (*SystemHandler) DeleteConfig ¶
func (h *SystemHandler) DeleteConfig(c *gin.Context)
DeleteConfig godoc @Summary 删除系统配置 @Description 管理员删除指定key的系统配置 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Param key path string true "配置键名" @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/system/configs/{key} [delete]
func (*SystemHandler) GetAuditLogs ¶
func (h *SystemHandler) GetAuditLogs(c *gin.Context)
GetAuditLogs godoc @Summary Get system audit logs @Description Admin query for system operation audit logs with optional filters. @Tags Admin System @Accept json @Produce json @Security BearerAuth @Param target_type query string false "Filter by target type" @Param action query string false "Filter by action" @Param page query int false "Page number" default(1) @Param page_size query int false "Page size" default(20) @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/system/audit-logs [get]
func (*SystemHandler) GetBackupConfig ¶
func (h *SystemHandler) GetBackupConfig(c *gin.Context)
GetBackupConfig godoc @Summary 获取备份配置 @Description 管理员获取系统备份配置 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/system/backup/config [get]
func (*SystemHandler) GetBackupStats ¶
func (h *SystemHandler) GetBackupStats(c *gin.Context)
GetBackupStats godoc @Summary 获取备份统计 @Description 管理员获取备份统计数据 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/system/backup/stats [get]
func (*SystemHandler) GetConfig ¶
func (h *SystemHandler) GetConfig(c *gin.Context)
GetConfig godoc @Summary 获取单个系统配置 @Description 管理员获取指定key的系统配置 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Param key path string true "配置键名" @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/system/configs/{key} [get]
func (*SystemHandler) GetConfigs ¶
func (h *SystemHandler) GetConfigs(c *gin.Context)
GetConfigs godoc @Summary 获取系统配置列表 @Description 管理员获取系统配置列表,支持按分组筛选 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Param group query string false "配置分组" @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/system/configs [get]
func (*SystemHandler) GetSubscriptionSettings ¶
func (h *SystemHandler) GetSubscriptionSettings(c *gin.Context)
GetSubscriptionSettings returns current subscription URL settings.
func (*SystemHandler) ListBackups ¶
func (h *SystemHandler) ListBackups(c *gin.Context)
ListBackups godoc @Summary 获取备份列表 @Description 管理员获取备份记录列表 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Param page query int false "页码" default(1) @Param page_size query int false "每页数量" default(20) @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/system/backups [get]
func (*SystemHandler) RestoreBackup ¶
func (h *SystemHandler) RestoreBackup(c *gin.Context)
RestoreBackup godoc @Summary 恢复备份 @Description 管理员从备份恢复系统 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Param id path int true "备份ID" @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/system/backups/{id}/restore [post]
func (*SystemHandler) SetConfig ¶
func (h *SystemHandler) SetConfig(c *gin.Context)
SetConfig godoc @Summary 设置系统配置 @Description 管理员设置系统配置项 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Param key path string true "配置键名" @Param request body map[string]any true "配置值" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/system/configs/{key} [put]
func (*SystemHandler) UpdateBackupConfig ¶
func (h *SystemHandler) UpdateBackupConfig(c *gin.Context)
UpdateBackupConfig godoc @Summary 更新备份配置 @Description 管理员更新系统备份配置 @Tags 管理端-系统 @Accept json @Produce json @Security BearerAuth @Param request body model.BackupConfig true "备份配置" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/system/backup/config [put]
type TelegramHandler ¶
type TelegramHandler struct {
// contains filtered or unexported fields
}
TelegramHandler Telegram Bot处理器
func (*TelegramHandler) Broadcast ¶
func (h *TelegramHandler) Broadcast(c *gin.Context)
Broadcast godoc @Summary 广播Telegram消息 @Description 管理员通过Telegram广播消息给所有绑定用户 @Tags 管理端-通知 @Accept json @Produce json @Security BearerAuth @Param request body BroadcastRequest true "广播请求" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /admin/telegram/broadcast [post]
func (*TelegramHandler) DeleteWebhook ¶
func (h *TelegramHandler) DeleteWebhook(c *gin.Context)
DeleteWebhook godoc @Summary 删除Telegram Webhook @Description 管理员删除Telegram Bot的Webhook配置 @Tags 管理端-通知 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/telegram/webhook [delete]
func (*TelegramHandler) GetBot ¶
func (h *TelegramHandler) GetBot(c *gin.Context)
GetBot godoc @Summary 获取Telegram Bot配置 @Description 管理员获取Telegram Bot的配置信息 @Tags 管理端-通知 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Failure 404 {object} map[string]any @Router /admin/telegram/bot [get]
func (*TelegramHandler) GetTelegramStatus ¶
func (h *TelegramHandler) GetTelegramStatus(c *gin.Context)
GetTelegramStatus godoc @Summary 获取Telegram绑定状态 @Description 用户获取自己的Telegram绑定状态 @Tags 用户端 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Router /user/telegram/status [get]
func (*TelegramHandler) GetUserBindings ¶
func (h *TelegramHandler) GetUserBindings(c *gin.Context)
GetUserBindings godoc @Summary 获取用户绑定列表 @Description 管理员获取Telegram用户绑定列表 @Tags 管理端-通知 @Accept json @Produce json @Security BearerAuth @Param page query int false "页码" default(1) @Param page_size query int false "每页数量" default(20) @Success 200 {object} map[string]any @Router /admin/telegram/users [get]
func (*TelegramHandler) SendNotification ¶
func (h *TelegramHandler) SendNotification(c *gin.Context)
SendNotification godoc @Summary 发送Telegram通知 @Description 管理员通过Telegram发送通知给指定用户 @Tags 管理端-通知 @Accept json @Produce json @Security BearerAuth @Param request body SendNotificationRequest true "通知请求" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/telegram/notify [post]
func (*TelegramHandler) SetWebhook ¶
func (h *TelegramHandler) SetWebhook(c *gin.Context)
SetWebhook godoc @Summary 设置Telegram Webhook @Description 管理员设置Telegram Bot的Webhook地址 @Tags 管理端-通知 @Accept json @Produce json @Security BearerAuth @Param request body SetWebhookRequest true "Webhook配置" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/telegram/webhook [post]
func (*TelegramHandler) TelegramWebhook ¶
func (h *TelegramHandler) TelegramWebhook(c *gin.Context)
TelegramWebhook godoc @Summary Telegram Webhook回调 @Description 接收Telegram Bot的Webhook回调 @Tags Telegram @Accept json @Produce json @Param request body service.TelegramUpdate true "Telegram Update" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /telegram/webhook [post]
func (*TelegramHandler) UnbindTelegram ¶
func (h *TelegramHandler) UnbindTelegram(c *gin.Context)
UnbindTelegram godoc @Summary 解绑Telegram @Description 尚未实现:不会解除绑定,始终返回错误(code=-1);请在 Telegram 机器人中发送 /unbind 解绑 @Tags 用户端 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Router /user/telegram/unbind [post]
func (*TelegramHandler) UpdateBot ¶
func (h *TelegramHandler) UpdateBot(c *gin.Context)
UpdateBot godoc @Summary 更新Telegram Bot配置 @Description 管理员更新Telegram Bot的配置信息 @Tags 管理端-通知 @Accept json @Produce json @Security BearerAuth @Param request body UpdateBotRequest true "Bot配置" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Failure 500 {object} map[string]any @Router /admin/telegram/bot [put]
func (*TelegramHandler) UpdateNotifySettings ¶
func (h *TelegramHandler) UpdateNotifySettings(c *gin.Context)
UpdateNotifySettings godoc @Summary 更新Telegram通知设置 @Description 尚未实现:校验请求体后始终返回错误(code=-1),不会修改任何设置 @Tags 用户端 @Accept json @Produce json @Security BearerAuth @Param request body NotifySettingsRequest true "通知设置" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /user/telegram/notify [post]
func (*TelegramHandler) UpdateUserNotify ¶
func (h *TelegramHandler) UpdateUserNotify(c *gin.Context)
UpdateUserNotify godoc @Summary 更新Telegram用户通知设置 @Description 管理员更新指定Telegram用户的通知开关 @Tags 管理端-通知 @Accept json @Produce json @Security BearerAuth @Param id path int true "Telegram绑定ID" @Param request body map[string]any true "通知设置" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Router /admin/telegram/users/{id}/notify [put]
type TestGostConnectionRequest ¶
type TestGostConnectionRequest struct {
Host string `json:"host" binding:"required"`
APIPort int `json:"api_port" binding:"required"`
APIToken string `json:"api_token"`
}
TestGostConnectionRequest 测试 gost 连接请求
type TicketHandler ¶
type TicketHandler struct{}
TicketHandler 用户端工单处理器
func (*TicketHandler) CloseTicket ¶
func (h *TicketHandler) CloseTicket(c *gin.Context)
CloseTicket 用户主动关闭工单
func (*TicketHandler) CreateTicket ¶
func (h *TicketHandler) CreateTicket(c *gin.Context)
CreateTicket 提交新工单
func (*TicketHandler) GetTicket ¶
func (h *TicketHandler) GetTicket(c *gin.Context)
GetTicket 获取工单详情及回话
func (*TicketHandler) GetTickets ¶
func (h *TicketHandler) GetTickets(c *gin.Context)
GetTickets 获取用户自己的工单列表
func (*TicketHandler) ReplyTicket ¶
func (h *TicketHandler) ReplyTicket(c *gin.Context)
ReplyTicket 回复自己的工单
type ToggleRequest ¶
type ToggleRequest struct {
Enabled bool `json:"enabled"`
}
ToggleRequest 切换状态请求
type UniProxyHandler ¶
type UniProxyHandler struct {
// contains filtered or unexported fields
}
UniProxyHandler handles node polling APIs.
func NewUniProxyHandler ¶
func NewUniProxyHandler() *UniProxyHandler
func (*UniProxyHandler) GetAliveList ¶
func (h *UniProxyHandler) GetAliveList(c *gin.Context)
GetAliveList returns online counts. GET /api/v1/server/UniProxy/alivelist
func (*UniProxyHandler) GetConfig ¶
func (h *UniProxyHandler) GetConfig(c *gin.Context)
GetConfig returns node config. GET /api/v1/server/UniProxy/config
func (*UniProxyHandler) GetUsers ¶
func (h *UniProxyHandler) GetUsers(c *gin.Context)
GetUsers returns active users. GET /api/v1/server/UniProxy/user
func (*UniProxyHandler) PushAlive ¶
func (h *UniProxyHandler) PushAlive(c *gin.Context)
PushAlive receives online IP report. POST /api/v1/server/UniProxy/alive
func (*UniProxyHandler) PushTraffic ¶
func (h *UniProxyHandler) PushTraffic(c *gin.Context)
PushTraffic receives traffic report. POST /api/v1/server/UniProxy/push
type UpdateBotRequest ¶
type UpdateBotRequest struct {
Name string `json:"name" binding:"omitempty,max=255"`
Token string `json:"token" binding:"omitempty,min=1"`
WelcomeMsg string `json:"welcome_msg" binding:"omitempty,max=1024"`
WelcomeMessage string `json:"welcome_message" binding:"omitempty,max=1024"`
AdminIDs any `json:"admin_ids"`
AllowBind *bool `json:"allow_bind"`
AllowSub *bool `json:"allow_sub"`
AllowTicket *bool `json:"allow_ticket"`
AllowInfo *bool `json:"allow_info"`
}
UpdateBotRequest 更新Bot请求
type UpdateGatewayRequest ¶
type UpdateGatewayRequest struct {
Name string `json:"name"`
Type string `json:"type" binding:"omitempty,oneof=alipay wechat stripe usdt epay"`
Icon string `json:"icon"`
Config any `json:"config"`
FeeRate *float64 `json:"fee_rate"`
FeeFixed *float64 `json:"fee_fixed"`
MinAmount *float64 `json:"min_amount"`
MaxAmount *float64 `json:"max_amount"`
Sort *int `json:"sort"`
Description string `json:"description"`
}
UpdateGatewayRequest 更新网关请求
type UpdateNodeRequest ¶
type UpdateNodeRequest struct {
Name string `json:"name"`
Type string `json:"type" binding:"omitempty,oneof=relay exit"`
Host string `json:"host"`
Port int `json:"port"`
APIPort int `json:"api_port"`
APIToken string `json:"api_token"`
MetricsPort int `json:"metrics_port"`
Region string `json:"region"`
ISP string `json:"isp"`
Bandwidth int64 `json:"bandwidth"`
Weight int `json:"weight"`
MaxConn int `json:"max_conn"`
Enabled *bool `json:"enabled"`
}
UpdateNodeRequest 更新节点请求
type UpdateRuleRequest ¶
type UpdateRuleRequest struct {
Name string `json:"name"`
RelayNodeID uint `json:"relay_node_id"`
ExitNodeID uint `json:"exit_node_id"`
ListenPort int `json:"listen_port"`
Protocol string `json:"protocol"`
TargetHost string `json:"target_host"`
TargetPort int `json:"target_port"`
SpeedLimit *int64 `json:"speed_limit"`
TrafficLimit *int64 `json:"traffic_limit"`
ExpireTime *time.Time `json:"expire_time"`
Remark string `json:"remark"`
}
UpdateRuleRequest 更新规则请求
type UserActivityEntry ¶ added in v4.2.0
type UserActivityEntry struct {
UserID uint `json:"user_id"`
LastOnlineAt *int64 `json:"last_online_at"`
}
UserActivityEntry is one user's activity: when the user was last seen online, a Unix time in seconds, or null for a user never seen.
type UserHandler ¶
type UserHandler struct {
// contains filtered or unexported fields
}
UserHandler 用户处理器
func (*UserHandler) GetDashboard ¶
func (h *UserHandler) GetDashboard(c *gin.Context)
GetDashboard godoc @Summary 获取用户仪表盘 @Description 获取当前登录用户的仪表盘数据,包括订阅信息等 @Tags 用户端 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 500 {object} map[string]any @Router /user/dashboard [get]
func (*UserHandler) GetProfile ¶
func (h *UserHandler) GetProfile(c *gin.Context)
GetProfile godoc @Summary 获取用户基本信息 @Description 获取当前登录用户的基本信息,包括邮箱、UUID、Token等 @Tags 用户端 @Accept json @Produce json @Security BearerAuth @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 404 {object} map[string]any @Router /user/profile [get]
func (*UserHandler) GetSubscription ¶
func (h *UserHandler) GetSubscription(c *gin.Context)
GetSubscription godoc @Summary 获取用户订阅详情 @Description 获取当前登录用户的订阅信息,包括流量、到期时间等 @Tags 用户端 @Accept json @Produce json @Security BearerAuth @Param refresh query bool false "是否强制刷新缓存" @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 500 {object} map[string]any @Router /user/subscription [get]
func (*UserHandler) ResetSubscription ¶ added in v4.1.0
func (h *UserHandler) ResetSubscription(c *gin.Context)
ResetSubscription godoc @Summary 重置我的订阅链接 @Description 用户为自己重新生成订阅 token,旧订阅链接立即失效(UUID 不变,与管理员重置相同)。需重新验证身份:未开启两步验证时提交当前密码,已开启时提交验证码或恢复码。每个用户每小时最多尝试 3 次。 @Tags 用户端 @Accept json @Produce json @Security BearerAuth @Param body body subscriptionResetRequest true "password,或 code 与可选的 method(totp / backup)" @Success 200 {object} map[string]any "data.token 为新的订阅 token" @Failure 400 {object} map[string]any @Router /user/subscription/reset [post]
type UserPlanHandler ¶
type UserPlanHandler struct{}
UserPlanHandler 用户端套餐处理器
func (*UserPlanHandler) GetPlans ¶
func (h *UserPlanHandler) GetPlans(c *gin.Context)
GetPlans 获取可购买的套餐列表
Source Files
¶
- admin.go
- admin_bulk.go
- admin_coupon.go
- admin_group_members.go
- admin_knowledge.go
- admin_ticket.go
- admin_user_activity.go
- agent.go
- agent_control.go
- agent_install.go
- auth.go
- coupon.go
- forward.go
- forward_clean_agent.go
- forward_flow.go
- forward_legacy.go
- forward_observability.go
- forward_panel.go
- forward_v4.go
- forward_v4_docs.go
- identity_jwks.go
- identity_logout.go
- invite.go
- invite_codes.go
- kernel.go
- kernel_admin_api_tokens.go
- kernel_agent.go
- kernel_agent_transports.go
- kernel_agent_upgrades.go
- kernel_agents.go
- kernel_alerts.go
- kernel_identity.go
- kernel_modules.go
- kernel_node_operations.go
- kernel_node_traffic.go
- kernel_notifications.go
- kernel_route_modes.go
- knowledge.go
- metrics.go
- mfa.go
- monitor_ws.go
- node.go
- notification.go
- order.go
- package_route_metrics.go
- payment.go
- payment_gateway.go
- payment_gateway_secrets.go
- payment_signature.go
- public_config.go
- speed_limit.go
- subscribe.go
- system.go
- system_audit.go
- telegram.go
- ticket.go
- uniproxy.go
- user.go
- user_plan.go
- user_subscription_reset.go
- validation.go