最新的gateway
This commit is contained in:
parent
309b18a2b7
commit
f7efb6faf3
2
go.mod
2
go.mod
|
@ -47,4 +47,4 @@ require (
|
|||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
replace fusen-basic v0.0.0 => gitee.com/fusenpack/fusen-basic v0.0.5-0.20231115062855-6f9b810c456b
|
||||
replace fusen-basic v0.0.0 => gitee.com/fusenpack/fusen-basic v0.0.5-0.20231116042329-f02917634c5e
|
||||
|
|
4
go.sum
4
go.sum
|
@ -1,6 +1,6 @@
|
|||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
gitee.com/fusenpack/fusen-basic v0.0.5-0.20231115062855-6f9b810c456b h1:CXhj7d67CykbMvTQPGi+iOoDnbhqchEc3i4AYBSovlo=
|
||||
gitee.com/fusenpack/fusen-basic v0.0.5-0.20231115062855-6f9b810c456b/go.mod h1:Zw6gt/0VwNmtG2Boqmo8+5H5AVuWsIVgCgp1ilkRyao=
|
||||
gitee.com/fusenpack/fusen-basic v0.0.5-0.20231116042329-f02917634c5e h1:7AP0afu7/BedGvbl8yqVUCB1GuDYsO/omHZ8Qlu3gGw=
|
||||
gitee.com/fusenpack/fusen-basic v0.0.5-0.20231116042329-f02917634c5e/go.mod h1:Zw6gt/0VwNmtG2Boqmo8+5H5AVuWsIVgCgp1ilkRyao=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo=
|
||||
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
|
||||
|
|
2
proto
2
proto
|
@ -1 +1 @@
|
|||
Subproject commit 6616d01aac4a969d7b260733de3673b9ee15470a
|
||||
Subproject commit 15818aeb2164a825e2003ff5d931d04c8a80e71a
|
|
@ -16,6 +16,11 @@ func AutoRegisterHandler(ctx context.Context, mux *runtime.ServeMux, opts ...grp
|
|||
return err
|
||||
}
|
||||
|
||||
err = service.RegisterFsserviceHandlerClientNacos(ctx, mux, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = service.RegisterInfoHandlerClientNacos(ctx, mux, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
15
server/logic/gateway_meta.go
Normal file
15
server/logic/gateway_meta.go
Normal file
|
@ -0,0 +1,15 @@
|
|||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
func PassMetadata(ctx context.Context, r *http.Request) metadata.MD {
|
||||
headerValue := r.Header.Get("Debug-Token")
|
||||
// 将值添加到 gRPC 元数据
|
||||
md := metadata.Pairs("debug-token", headerValue)
|
||||
return md
|
||||
}
|
|
@ -27,6 +27,7 @@ func main() {
|
|||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
mux := runtime.NewServeMux(
|
||||
runtime.WithMetadata(logic.PassMetadata),
|
||||
runtime.WithForwardResponseOption(logic.ResponseHeaderMatcher),
|
||||
runtime.WithMarshalerOption("*", &logic.EmptyMarshaler{}),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user