Documentation
¶
Overview ¶
Package serverutil provides helper functions to main.go files.
Index ¶
- func GRPCGatewayServer(ctx context.Context, grpcServer *grpc.Server, conn *grpc.ClientConn, ...) (*http.Server, error)
- func ListenForCtrlC(servers ...interface{ Shutdown(context.Context) error })
- func ListenTLS(ctx context.Context, listenAddr, certFile, keyFile string) (net.Listener, *grpc.ClientConn, func(), error)
- func MetricsServer(addr string, opts *server.Options) *server.Server
- func RootHealthHandler(otherHandler http.Handler) http.HandlerFunc
- type RegisterServiceFromConn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GRPCGatewayServer ¶ added in v0.3.0
func GRPCGatewayServer(ctx context.Context, grpcServer *grpc.Server, conn *grpc.ClientConn, services ...RegisterServiceFromConn) (*http.Server, error)
GRPCGatewayServer returns a server for given services over HTTP / JSON and gRPC.
func ListenForCtrlC ¶ added in v0.3.0
ListenForCtrlC gracefully stops all the servers on an interrupt signal.
func ListenTLS ¶ added in v0.2.0
func ListenTLS(ctx context.Context, listenAddr, certFile, keyFile string) (net.Listener, *grpc.ClientConn, func(), error)
ListenTLS binds to listenAddr and returns a gRPC connection to it.
func MetricsServer ¶ added in v0.3.0
MetricsServer returns server with monitoring APIs
func RootHealthHandler ¶ added in v0.2.0
func RootHealthHandler(otherHandler http.Handler) http.HandlerFunc
RootHeaalthHandler handles liveness checks at "/". All other requests are passed through to `otherHandler`.
Types ¶
type RegisterServiceFromConn ¶ added in v0.2.0
RegisterServiceFromConn registers services with a grpc server's ServeMux
Click to show internal directories.
Click to hide internal directories.