Documentation
¶
Overview ¶
Package server 的 cookie interceptor。
从 gRPC metadata 提取上游网易云 cookie(x-netease-cookie), 调 engine.WithCookie 注入 context。凭证出域——cookie 不进 proto 字段, 由 interceptor 统一从 metadata 提取,service 对 cookie 来源透明。
REST 调用方经 grpc-gateway 传 "Grpc-Metadata-X-Netease-Cookie" header, gateway 自动桥接到 metadata key "x-netease-cookie"(前缀剥离)。
Package server 装配 gRPC server 与 grpc-gateway runtime mux。
gRPC server 监听 gRPC 端口对外提供强类型 RPC;gateway runtime mux 监听 HTTP 端口, 通过 dial 连本地 gRPC server,把 REST 请求转成 gRPC 调用。这是双 server 标准架构: 跨语言调用方走 gRPC,curl/Postman/前端走 gateway 暴露的 REST。
地基阶段(issue 0001):service 全部注册为 unimplemented 占位,只保证 server 能启动、 grpcurl 能 reflection 连上。真实接口实现在 issue 0005 迁移 15 接口时填入。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CookieInterceptor ¶
func CookieInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error)
CookieInterceptor 从 incoming metadata 提取网易云 cookie,注入 context。
无 metadata 或无 cookie key 时注入空字符串——engine 据此走 session 池选取。
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App 持有 gRPC server 与 gateway HTTP server,统一管理生命周期。