Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Version = "dev"
Version 为构建时通过 -ldflags 注入的版本号,如 "v1.2.3" 未注入时默认为 "dev"
Functions ¶
func SetupRouter ¶
SetupRouter 统一加载所有已注册的 Controller mode: debug | release | test,在创建 Engine 前设置 trustedProxies: 反向代理可信 IP 列表,影响 c.ClientIP() allowedOrigins: CORS 允许的来源域名列表
Types ¶
type Controller ¶
type Controller interface {
// Register 注册路由到给定的 Group(已带 /api/<moduleName> 前缀)
Register(r *gin.RouterGroup)
// ModuleName 返回模块名,用作路由前缀
ModuleName() string
// Enabled 返回模块是否启用;未启用时跳过路由注册
Enabled() bool
}
Controller 接口:所有独立的 API 模块都需实现此接口
Directories
¶
| Path | Synopsis |
|---|---|
|
Package modules 模块汇入点 每新增一个子模块,在此文件追加一行匿名导入即可
|
Package modules 模块汇入点 每新增一个子模块,在此文件追加一行匿名导入即可 |
|
hitcount
Package hitcount 提供访问计数(hits)模块,参考 dwyl/hits 的用法, 但不沿用其数据库设计:计数按「键值对」存储,键为路径、值为累计次数 (表 hitcount_hits,主键 path)。
|
Package hitcount 提供访问计数(hits)模块,参考 dwyl/hits 的用法, 但不沿用其数据库设计:计数按「键值对」存储,键为路径、值为累计次数 (表 hitcount_hits,主键 path)。 |
|
pathproxy
Package pathproxy 路径代理模块:把 /api/pathproxy/<path> 的请求按配置 规则转发到对应上游 URL,支持精确路径与末尾 "*" 通配。
|
Package pathproxy 路径代理模块:把 /api/pathproxy/<path> 的请求按配置 规则转发到对应上游 URL,支持精确路径与末尾 "*" 通配。 |
|
siteinfo
Package siteinfo 网页信息抓取(site-info-api 移植):
|
Package siteinfo 网页信息抓取(site-info-api 移植): |
|
starhistory
Package starhistory 移植 star-history(github.com/Mubelotix/star-history) 的 SVG 星标历史图表生成能力,仅保留 /svg 图像接口。
|
Package starhistory 移植 star-history(github.com/Mubelotix/star-history) 的 SVG 星标历史图表生成能力,仅保留 /svg 图像接口。 |