Documentation
¶
Index ¶
- Constants
- func AuthKey(key string, directKeyName ...bool) string
- func HTTPToGRPC(httpCode int) codes.Code
- func StatusError(status codes.Code) bool
- func StatusWarn(status codes.Code) bool
- type CallContext
- type GrpcServerRunner
- type Request
- func (r *Request) CheckRequestContent(smsMessage *string, skipSms *bool) error
- func (r *Request) ClientIp() string
- func (r *Request) Close(successMessage ...string)
- func (r *Request) Context() context.Context
- func (r *Request) Error() error
- func (r *Request) FormData() map[string][]string
- func (r *Request) FormFile() (*multipart.FileHeader, error)
- func (r *Request) GetAuthParameter(authMethodProtocol string, key string, directKeyName ...bool) string
- func (r *Request) GetParameter(key string) (any, bool)
- func (r *Request) GetRequestClientIp() string
- func (r *Request) GetRequestContent() []byte
- func (r *Request) GetRequestMethod() string
- func (r *Request) GetRequestPath() string
- func (r *Request) GetRequestUserAgent() string
- func (r *Request) GetResourceId(resourceType string) api.ResourceId
- func (r *Request) GetTenancyId() string
- func (r *Request) Init(s *Server, ctx CallContext, fields ...logger.Fields) error
- func (r *Request) MessageFromRequest(builder func() interface{}) (interface{}, error)
- func (r *Request) Method() string
- func (r *Request) ParseAndValidate(cmd interface{}) error
- func (r *Request) PayloadSize() int
- func (r *Request) ResourceIds() api.ResourceIds
- func (r *Request) Response() api_server.Response
- func (r *Request) Server() api_server.Server
- func (r *Request) SetAuthParameter(authMethodProtocol string, key string, value string, directKeyName ...bool)
- func (r *Request) SetParameter(key string, value any)
- func (r *Request) StatusCode() codes.Code
- func (r *Request) StatusMessage() string
- func (r *Request) UserAgent() string
- func (r *Request) Validate(cmd interface{}) error
- type RequestCodec
- type RequestWrapper
- type Response
- type Server
- func (s *Server) AddEndpoint(service api_server.Service, ep api_server.Endpoint, methods *[]grpc.MethodDesc)
- func (s *Server) Config() interface{}
- func (s *Server) ConfigPoolService() pool.PoolService
- func (s *Server) DynamicTables() api_server.DynamicTables
- func (s *Server) FullMethodName(service api_server.Service, ep api_server.Endpoint) string
- func (s *Server) GrpcUnaryHandler(service api_server.Service, ep api_server.Endpoint) *UnaryHandler
- func (s *Server) Init(ctx app_context.Context, auth auth.Auth, ...) error
- func (s *Server) IsMultitenancy() bool
- func (s *Server) ListEndpoints()
- func (s *Server) MakeResponseError(gerr generic_error.Error) (int, generic_error.Error)
- func (s *Server) RegisterService(service api_server.Service) error
- func (s *Server) Run(fin background_worker.Finisher)
- func (s *Server) SetConfigFromPoolService(service pool.PoolService, public ...bool)
- func (s *Server) SetPropagateAuthUser(val bool)
- func (s *Server) SetPropagateContextId(val bool)
- func (s *Server) TenancyManager() multitenancy.Multitenancy
- func (s *Server) Testing() bool
- type ServerConfig
- type SizeInfo
- type UnaryHandler
Constants ¶
View Source
const DefaultGrpcConfigSection string = "grpc"
View Source
const HeaderSizeKey = "gu-hsize"
View Source
const OriginType = "grpc"
View Source
const RequestContextKey = "gu-request"
Variables ¶
This section is empty.
Functions ¶
func HTTPToGRPC ¶
func StatusError ¶
func StatusWarn ¶
Types ¶
type CallContext ¶
type GrpcServerRunner ¶
type Request ¶
type Request struct {
api_server.RequestBase
// contains filtered or unexported fields
}
func (*Request) CheckRequestContent ¶
func (*Request) GetAuthParameter ¶
func (*Request) GetRequestClientIp ¶
func (*Request) GetRequestContent ¶
func (*Request) GetRequestMethod ¶
func (*Request) GetRequestPath ¶
func (*Request) GetRequestUserAgent ¶
func (*Request) GetResourceId ¶
func (r *Request) GetResourceId(resourceType string) api.ResourceId
func (*Request) GetTenancyId ¶
func (*Request) MessageFromRequest ¶
func (*Request) ParseAndValidate ¶
func (*Request) PayloadSize ¶
func (*Request) ResourceIds ¶
func (r *Request) ResourceIds() api.ResourceIds
func (*Request) Response ¶
func (r *Request) Response() api_server.Response
func (*Request) Server ¶
func (r *Request) Server() api_server.Server
func (*Request) SetAuthParameter ¶
func (*Request) SetParameter ¶
func (*Request) StatusCode ¶
func (*Request) StatusMessage ¶
type RequestCodec ¶
type RequestCodec struct {
// contains filtered or unexported fields
}
func (*RequestCodec) Marshal ¶
func (c *RequestCodec) Marshal(v any) (mem.BufferSlice, error)
func (*RequestCodec) Name ¶
func (c *RequestCodec) Name() string
func (*RequestCodec) Unmarshal ¶
func (c *RequestCodec) Unmarshal(data mem.BufferSlice, v any) (err error)
type RequestWrapper ¶
type RequestWrapper struct {
// contains filtered or unexported fields
}
type Response ¶
type Response struct {
api_server.ResponseBase
}
type Server ¶
type Server struct {
ServerConfig
api_server.ServerBase
generic_error.ErrorManagerBaseHttp
auth.WithAuthBase
// contains filtered or unexported fields
}
func (*Server) AddEndpoint ¶
func (s *Server) AddEndpoint(service api_server.Service, ep api_server.Endpoint, methods *[]grpc.MethodDesc)
func (*Server) ConfigPoolService ¶
func (s *Server) ConfigPoolService() pool.PoolService
func (*Server) DynamicTables ¶
func (s *Server) DynamicTables() api_server.DynamicTables
func (*Server) FullMethodName ¶
func (s *Server) FullMethodName(service api_server.Service, ep api_server.Endpoint) string
func (*Server) GrpcUnaryHandler ¶
func (s *Server) GrpcUnaryHandler(service api_server.Service, ep api_server.Endpoint) *UnaryHandler
func (*Server) Init ¶
func (s *Server) Init(ctx app_context.Context, auth auth.Auth, tenancyManager multitenancy.Multitenancy, configPath ...string) error
func (*Server) IsMultitenancy ¶
func (*Server) ListEndpoints ¶
func (s *Server) ListEndpoints()
func (*Server) MakeResponseError ¶
func (s *Server) MakeResponseError(gerr generic_error.Error) (int, generic_error.Error)
func (*Server) RegisterService ¶
func (s *Server) RegisterService(service api_server.Service) error
func (*Server) Run ¶
func (s *Server) Run(fin background_worker.Finisher)
func (*Server) SetConfigFromPoolService ¶
func (s *Server) SetConfigFromPoolService(service pool.PoolService, public ...bool)
func (*Server) SetPropagateAuthUser ¶
func (*Server) SetPropagateContextId ¶
func (*Server) TenancyManager ¶
func (s *Server) TenancyManager() multitenancy.Multitenancy
type ServerConfig ¶
type ServerConfig struct {
api_server.ServerBaseConfig
HOST string `default:"127.0.0.1" validate:"ip"`
PORT uint16 `validate:"required"`
PROTOCOL string `default:"tcp" validate:"omitempty,oneof=tcp udp"`
TRUSTED_PROXIES []string
VERBOSE bool
VERBOSE_BODY_MAX_LENGTH int `default:"2048"`
ALLOW_BLOCKED_TENANCY_PATH bool
AUTH_FROM_TENANCY_DB bool `default:"true"`
SHADOW_TENANCY_PATH bool
TENANCY_ALLOWED_IP_LIST_TAG string
TENANCY_ALLOWED_IP_LIST bool
REAL_IP_HEADER string `validate:"required" default:"X-Forwarded-For"`
TENANCY_HEADER string `validate:"omitempty,hostname_rfc1123|alphanum" default:"X-Tenancy-Id"`
TRANSPORT_CODEC_TYPE string `validate:"required,hostname_rfc1123|alphanum" default:"proto-hatn"`
STATUS_HEADER string `validate:"required,hostname_rfc1123|alphanum" default:"x-hatn-status"`
ID_HEADER string `validate:"omitempty,hostname_rfc1123|alphanum" default:"x-hatn-id"`
MESSAGE_TYPE_HEADER string `validate:"required,hostname_rfc1123|alphanum" default:"x-hatn-mtype"`
ERROR_FAMILY_HEADER string `validate:"omitempty,hostname_rfc1123|alphanum" default:"x-hatn-efamily"`
ERROR_DESCRIPTION_HEADER string `default:"x-hatn-edescription"`
ERROR_DETAILS_HEADER string `default:"x-hatn-edetails"`
RESOURCE_ID_HEADER_PREFIX string `default:"x-hatn-rid"`
TLS_CERTIFICATE_FILE string
TLS_PRIVATE_KEY_FILE string
DISABLE_TLS bool
}
type UnaryHandler ¶
type UnaryHandler struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.