Documentation ¶
Index ¶
- func SetAccessLog(accessLog AccessLog)
- func SetMetricsRecord(metricsRecord MetricsRecord)
- func StreamAccess(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, ...) (err error)
- func StreamValidator(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, ...) (err error)
- func UnaryValidator(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (resp interface{}, err error)
- type AccessLog
- type Http
- type Http3
- type HttpOption
- type IOption
- type MetricsRecord
- type Option
- func WithContext(ctx context.Context) Option
- func WithCors(cors *cors.Options) Option
- func WithGinHandler(ginHandler func(*gin.Engine)) Option
- func WithGraphqlHandler(graphqlHandler graphql.ExecutableSchema) Option
- func WithGrpcHandler(grpcHandler func(*grpc.Server)) Option
- func WithGrpcOptions(options ...grpc.ServerOption) Option
- func WithGrpcWeb(options ...web.Option) Option
- func WithHttp3Addr(addr string) Option
- func WithHttpAddr(addr string) Option
- func WithMiddlewares(middlewares ...http.HandlerFunc) Option
- func WithName(name string) Option
- func WithOnStart(onStart func(context.Context)) Option
- func WithOnStop(onStop func(context.Context)) Option
- func WithStopTimeout(stopTimeout time.Duration) Option
- func WithTelemetry(telemetry TelemetryConfig) Option
- type Server
- type StaticFsConfig
- type TelemetryConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetAccessLog ¶
func SetAccessLog(accessLog AccessLog)
func SetMetricsRecord ¶
func SetMetricsRecord(metricsRecord MetricsRecord)
func StreamAccess ¶
func StreamAccess(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) (err error)
func StreamValidator ¶
func StreamValidator(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) (err error)
func UnaryValidator ¶
func UnaryValidator( ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler, ) (resp interface{}, err error)
Types ¶
type HttpOption ¶
type HttpOption struct { ExcludeLogPrefixes []string IncludeLogPrefixes []string StaticFs []StaticFsConfig Middlewares []http.HandlerFunc }
type IOption ¶ added in v1.16.7
type IOption interface {
// contains filtered or unexported methods
}
type Option ¶ added in v1.16.7
type Option func(server *Server)
func WithContext ¶ added in v1.16.7
func WithGinHandler ¶ added in v1.16.7
func WithGraphqlHandler ¶ added in v1.16.7
func WithGraphqlHandler(graphqlHandler graphql.ExecutableSchema) Option
func WithGrpcHandler ¶ added in v1.16.7
func WithGrpcOptions ¶ added in v1.16.7
func WithGrpcOptions(options ...grpc.ServerOption) Option
func WithGrpcWeb ¶ added in v1.16.7
func WithHttp3Addr ¶ added in v1.16.7
func WithHttpAddr ¶ added in v1.16.7
func WithMiddlewares ¶ added in v1.16.7
func WithMiddlewares(middlewares ...http.HandlerFunc) Option
func WithOnStart ¶ added in v1.16.7
func WithOnStop ¶ added in v1.16.7
func WithStopTimeout ¶ added in v1.16.7
func WithTelemetry ¶ added in v1.16.7
func WithTelemetry(telemetry TelemetryConfig) Option
type Server ¶
type Server struct { Name string Http Http Http2 http2.Server Http3 *Http3 StopTimeout time.Duration Gin gini.Config EnableCors bool Cors *cors.Options Middlewares []http.HandlerFunc HttpOption HttpOption // Grpc options GrpcOptions []grpc.ServerOption EnableGrpcWeb bool GrpcWebOptions []web.Option EnableTelemetry, EnableDebugApi, EnableApiDoc bool ApiDocUriPrefix, ApiDocDir string TelemetryConfig BaseContext context.Context // 注册 grpc 服务 GrpcHandler func(*grpc.Server) // 注册 grpc-gateway 服务 GatewayHandler runtime.GatewayHandler // 注册 gin 服务 GinHandler func(*gin.Engine) // 注册 graphql 服务 GraphqlHandler graphql.ExecutableSchema // 各种钩子函数 OnStart func(context.Context) OnStop func(context.Context) }
func (*Server) AfterInject ¶ added in v1.16.17
func (s *Server) AfterInject()
func (*Server) BeforeInject ¶ added in v1.16.17
func (s *Server) BeforeInject()
implement initialize
func (*Server) UnaryAccess ¶ added in v1.16.7
func (s *Server) UnaryAccess(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)
func (*Server) WithOptions ¶ added in v1.16.7
type StaticFsConfig ¶
type TelemetryConfig ¶
type TelemetryConfig struct { EnablePrometheus bool MetricsInterval time.Duration // contains filtered or unexported fields }
func (*TelemetryConfig) SetMeterProvider ¶
func (c *TelemetryConfig) SetMeterProvider(meterProvider *sdkmetric.MeterProvider)
func (*TelemetryConfig) SetTextMapPropagator ¶
func (c *TelemetryConfig) SetTextMapPropagator(propagator propagation.TextMapPropagator)
func (*TelemetryConfig) SetTracerProvider ¶
func (c *TelemetryConfig) SetTracerProvider(tracerProvider *sdktrace.TracerProvider)
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
_example
|
|
protobuf/user
Package user is a reverse proxy.
|
Package user is a reverse proxy. |
gateway
|
|
Click to show internal directories.
Click to hide internal directories.