controlapi

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: GPL-3.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package controlapi 实现 daemon listener 上的本机内部控制 API(/control/*)。

它是守卫侧的 controller 层:只做协议转换(HTTP/JSON ↔ 桥接调用)与控制令牌鉴权,一切有状态 逻辑交给 Bridge。扁平信任下控制令牌是唯一传输闸门:带令牌即拥有全部能力,不再逐客户端令牌 / scope 判定;调用方自报的客户端标签只用于审计归因。与扩展 WS 面共用同一 listener、走独立路径; 除 /control/health 外均要求控制令牌。请求/响应 DTO 与前端共享,见 internal/client/control。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bridge

type Bridge interface {
	Version() string
	Action(name string) (protocol.Action, bool)
	ExtConnected() bool
	AuditSnapshot() []audit.Event
	Call(ctx context.Context, req bridge.Request) (bridge.Response, error)
	BeginEnrollment() (string, error)
}

Bridge 是控制 API 依赖的守卫侧能力面,由 *bridge.Server 实现。 收窄到这几个方法既是为了让本包能独立测试,也是为了标明控制 API 不该碰 WS 连接状态。

type Handler

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

Handler 是控制 API 的处理器集合。

func New

func New(b Bridge, token string, log *zap.Logger) *Handler

New 构造控制 API。token 是 daemon 绑定端口后落盘的 0600 控制令牌;空令牌下除健康检查外全拒。

func (*Handler) Register

func (h *Handler) Register(mux *http.ServeMux)

Register 把控制 API 挂到 daemon listener 的 mux 上。

Jump to

Keyboard shortcuts

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