serve

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package serve provides helpers to start and shutdown network services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GRPC added in v0.3.0

func GRPC(ctx Ctx, addr netx.Addr, srv *grpc.Server, service string) (err error)

GRPC starts gRPC server on addr, logged as service. It runs until failed or ctx.Done.

func HTTP

func HTTP(ctx Ctx, addr netx.Addr, tlsConfig *tls.Config, handler http.Handler, service string) error

HTTP starts HTTP server on addr using handler logged as service. It runs until failed or ctx.Done.

func HandleMetrics added in v0.2.0

func HandleMetrics(mux *http.ServeMux, reg *prometheus.Registry)

HandleMetrics adds reg's prometheus handler on /metrics at mux.

func Metrics

func Metrics(ctx Ctx, addr netx.Addr, reg *prometheus.Registry) error

Metrics starts HTTP server on addr path /metrics using reg as prometheus handler.

func RPC

func RPC(ctx Ctx, addr netx.Addr, tlsConfig *tls.Config, rcvr interface{}) error

RPC starts HTTP server on addr path /rpc using rcvr as JSON-RPC 2.0 handler.

func RPCName

func RPCName(ctx Ctx, addr netx.Addr, tlsConfig *tls.Config, rcvr interface{}, name string) (err error)

RPCName starts HTTP server on addr path /rpc using rcvr as JSON-RPC 2.0 handler but uses the provided name for the type instead of the receiver's concrete type.

Types

type Ctx

type Ctx = context.Context

Ctx is a synonym for convenience.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL