muxserver

package
v0.0.0-...-5afbac7 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RemoteAddrKey is the key for the remote address.
	RemoteAddrKey = "remote-addr"

	// LocalAddrKey is the key for the local address.
	LocalAddrKey = "local-addr"
)

Variables

View Source
var (
	ErrServerActive         = errors.New("server is already active")
	ErrServerListenerActive = errors.New("server listener is still active - close listener first")
)

Functions

This section is empty.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server

DRPC server that handles multiplexed streams

func New

func New(handler drpc.Handler) *Server

New returns a new multiplexed Server that serves handler

func NewWithOptions

func NewWithOptions(handler drpc.Handler, opts drpcserver.Options) *Server

NewWithOptions

Same as New but passes options to DRPC

func (*Server) Close

func (s *Server) Close() error

Close

Closes the server waiting for all inflight requests to complete.
If Serve has been called, the listener that called server should be
closed before this function is called.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, ln net.Listener) error

Serve

Listens on the given listener and handles all multiplexed streams.

func (*Server) ServeOne

func (s *Server) ServeOne(ctx context.Context, conn io.ReadWriteCloser) error

ServeOne

Serves a single set of rpcs on the provided transport.

func (*Server) SetLogger

func (s *Server) SetLogger(logger *zap.Logger)

SetLogger sets the logger for the server

Jump to

Keyboard shortcuts

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