mux

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

README

Mux

mux package provides protocol multiplexing for HTTP & gRPC servers.

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, listenAddr string, opts ...Option) error

Serve starts a TCP listener and serves the registered protocol servers and blocks until server exits. Context can be cancelled to perform graceful shutdown. Use WithHTTP() and WithGRPC() to register protocol servers.

Types

type Option

type Option func(m *muxServer) error

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

func WithGRPC

func WithGRPC(server *grpc.Server) Option

WithGRPC registers the gRPC-server for use in Serve().

func WithGracePeriod

func WithGracePeriod(d time.Duration) Option

WithGracePeriod sets the wait duration for graceful shutdown.

func WithHTTP

func WithHTTP(h http.Handler) Option

WithHTTP registers the http-server for use in Serve().

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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