Documentation
¶
Index ¶
- Variables
- type API
- type GRPCOptions
- type GRPCRegistrations
- type Gateway
- type GatewayOptions
- type HandlerRegistrations
- type Health
- type Server
- type ServiceFactory
- type ServiceInterface
- type ServiceManager
- func (s *ServiceManager) AddGRPCServer(server *Server) error
- func (s *ServiceManager) SetupHealthServer(address string, certs *certs.TLSCredsConfig) error
- func (s *ServiceManager) SetupMetricsServer(address string, certs *certs.TLSCredsConfig, enableZpages bool) ([]grpc.ServerOption, error)
- func (s *ServiceManager) StartServers(ctx context.Context) error
- func (s *ServiceManager) StopServers(ctx context.Context)
- func (s *ServiceManager) WithShutdownTimeout(seconds int) *ServiceManager
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultGatewayAllowedHeaders = []string{headers.Authorization, headers.ContentType, headers.IfMatch, headers.IfNoneMatch, "Depth"}
View Source
var DefaultGatewayAllowedMethods = []string{http.MethodGet, http.MethodPost, http.MethodHead, http.MethodDelete, http.MethodPut, http.MethodPatch, "PROPFIND", "MKCOL", "COPY", "MOVE"}
View Source
var DefaultGatewayAllowedOrigins = []string{
"http://localhost",
"http://localhost:*",
"https://localhost",
"https://localhost:*",
"http://127.0.0.1",
"http://127.0.0.1:*",
"https://127.0.0.1",
"https://127.0.0.1:*",
}
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
Needs []string `json:"needs"`
GRPC struct {
ListenAddress string `json:"listen_address"`
// Default connection timeout is 120 seconds
// https://godoc.org/google.golang.org/grpc#ConnectionTimeout
ConnectionTimeoutSeconds uint32 `json:"connection_timeout_seconds"`
Certs certs.TLSCredsConfig `json:"certs"`
} `json:"grpc"`
Gateway struct {
ListenAddress string `json:"listen_address"`
AllowedOrigins []string `json:"allowed_origins"`
AllowedHeaders []string `json:"allowed_headers"`
AllowedMethods []string `json:"allowed_methods"`
Certs certs.TLSCredsConfig `json:"certs"`
HTTP bool `json:"http"`
ReadTimeout time.Duration `json:"read_timeout"`
ReadHeaderTimeout time.Duration `json:"read_header_timeout"`
WriteTimeout time.Duration `json:"write_timeout"`
IdleTimeout time.Duration `json:"idle_timeout"`
} `json:"gateway"`
}
type GRPCOptions ¶ added in v0.0.9
type GRPCOptions struct {
ServerOptions []grpc.ServerOption
Registrations GRPCRegistrations
}
type GRPCRegistrations ¶
type Gateway ¶
func (*Gateway) AddHandler ¶ added in v0.0.3
func (g *Gateway) AddHandler(pattern string, handler http.HandlerFunc)
type GatewayOptions ¶ added in v0.0.9
type GatewayOptions struct {
HandlerRegistrations HandlerRegistrations
ErrorHandler runtime.ErrorHandlerFunc
}
type HandlerRegistrations ¶
type Health ¶ added in v0.0.6
func (*Health) SetServiceStatus ¶ added in v0.0.6
func (h *Health) SetServiceStatus(service string, status healthpb.HealthCheckResponse_ServingStatus)
type ServiceFactory ¶
type ServiceFactory struct {
}
func NewServiceFactory ¶
func NewServiceFactory() *ServiceFactory
func (*ServiceFactory) CreateService ¶
func (f *ServiceFactory) CreateService( config *API, grpcOpts *GRPCOptions, gatewayOpts *GatewayOptions, cleanup ...func(), ) (*Server, error)
type ServiceInterface ¶
type ServiceManager ¶
type ServiceManager struct {
Context context.Context
Servers map[string]*Server
DependencyMap map[string][]string
HealthServer *Health
MetricServer *http.Server
// contains filtered or unexported fields
}
func NewServiceManager ¶
func NewServiceManager(logger *zerolog.Logger) *ServiceManager
func (*ServiceManager) AddGRPCServer ¶
func (s *ServiceManager) AddGRPCServer(server *Server) error
func (*ServiceManager) SetupHealthServer ¶ added in v0.0.6
func (s *ServiceManager) SetupHealthServer(address string, certs *certs.TLSCredsConfig) error
func (*ServiceManager) SetupMetricsServer ¶ added in v0.0.6
func (s *ServiceManager) SetupMetricsServer(address string, certs *certs.TLSCredsConfig, enableZpages bool) ([]grpc.ServerOption, error)
func (*ServiceManager) StartServers ¶
func (s *ServiceManager) StartServers(ctx context.Context) error
func (*ServiceManager) StopServers ¶
func (s *ServiceManager) StopServers(ctx context.Context)
func (*ServiceManager) WithShutdownTimeout ¶ added in v0.0.6
func (s *ServiceManager) WithShutdownTimeout(seconds int) *ServiceManager
Click to show internal directories.
Click to hide internal directories.