Documentation
¶
Index ¶
- type AppConn
- type AuthHeaders
- type AuthHeadersFunc
- type GRPCMethodConfig
- type Router
- func (rr *Router) AddMiddleware(middleware func(http.Handler) http.Handler)
- func (rr *Router) RegisterGRPCService(ctx context.Context, sd protoreflect.ServiceDescriptor, invoker AppConn) error
- func (rr *Router) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (rr *Router) SetGlobalAuth(auth AuthHeaders)
- func (rr *Router) SetHealthCheck(path string, callback func() error)
- func (rr *Router) SetNotFoundHandler(handler http.Handler)
- func (rr *Router) StaticJSON(path string, document any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppConn ¶
type AppConn interface {
// Invoke is designed for gRPC ClientConn.Invoke, the two interfaces should
// be protos...
Invoke(context.Context, string, any, any, ...grpc.CallOption) error
JSONToProto(body []byte, msg protoreflect.Message) error
QueryToProto(query url.Values, msg protoreflect.Message) error
ProtoToJSON(msg protoreflect.Message) ([]byte, error)
}
type AuthHeaders ¶
type AuthHeaders interface {
AuthHeaders(context.Context, *http.Request) (map[string]string, error)
}
AuthHeaders translates a request into headers to pass on to the remote server Errors which implement gRPC status will be returned to the client as HTTP errors, otherwise 500 with a log line
type AuthHeadersFunc ¶
func (AuthHeadersFunc) AuthHeaders ¶
type GRPCMethodConfig ¶
type GRPCMethodConfig struct {
AuthHeaders AuthHeaders
Invoker AppConn
Method protoreflect.MethodDescriptor
}
type Router ¶
type Router struct {
ForwardResponseHeaders map[string]bool
ForwardRequestHeaders map[string]bool
// contains filtered or unexported fields
}
func (*Router) AddMiddleware ¶
func (*Router) RegisterGRPCService ¶
func (rr *Router) RegisterGRPCService(ctx context.Context, sd protoreflect.ServiceDescriptor, invoker AppConn) error
func (*Router) SetGlobalAuth ¶
func (rr *Router) SetGlobalAuth(auth AuthHeaders)
func (*Router) SetHealthCheck ¶
func (*Router) SetNotFoundHandler ¶
Click to show internal directories.
Click to hide internal directories.