Documentation
¶
Overview ¶
Package server 把 vault 与 render 组装成 HTTP 服务。 本包不含业务逻辑,只做路由、参数校验与序列化。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server 持有各组件并暴露 HTTP 接口。
func New ¶
New 构造 Server。webFS 是 embed 进来的前端资源文件系统。 w 为 nil 时整个 /api/edit/ 挂载点不存在,程序退化为只读阅读器,这是 唯一支持的 nil 配置。g 必须非 nil:/auth、/api/session 无条件挂载 (不像 /api/edit/ 那样受 w 是否为 nil 控制),两者都会直接解引用 g, 传 nil 会在请求到达时 panic,而不是退化成什么可用状态。
func (*Server) StartWatching ¶
StartWatching 启动文件监听循环,把 vault 的变更广播给所有已连接的浏览器。 ctx 结束时循环退出。
Click to show internal directories.
Click to hide internal directories.