mux

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 9 Imported by: 1

README

Mux

mux package provides helpers for starting multiple servers. HTTP and gRPC servers are supported currently.

Usage

Refer _example/ for usage reference.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(ctx context.Context, opts ...Option) error

Serve starts TCP listeners and serves the registered protocol servers of the given serveTarget(s) and blocks until the servers exit. Context can be cancelled to perform graceful shutdown.

Types

type Option

type Option func(m *muxServer) error

Option values can be used with Serve() for customisation.

func WithGRPCTarget

func WithGRPCTarget(addr string, srv *grpc.Server) Option

func WithGracePeriod

func WithGracePeriod(d time.Duration) Option

WithGracePeriod sets the wait duration for graceful shutdown.

func WithHTTPTarget

func WithHTTPTarget(addr string, srv *http.Server) Option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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