server

package
v0.0.0-...-f0d76f6 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLogger

func SetLogger(entry *log.Entry)

SetLogger sets the global logger used by the package's entities. It should be called during initialization, and it is strongly recommended not to change it afterward.

Types

type Server

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

Server represents a gRPC-Gateway server that bridges gRPC services with HTTP/REST clients.

func NewServer

func NewServer(cfg *grpcserver.Config, tlsConfig *tls.Config) (*Server, error)

NewServer creates and configures a new gRPC Gateway server.

Communication with the gRPC server takes place via a unix socket (GRPCSocketPath field in grpcserver.Config structure).

When configuring the connection, аn unary client logging interceptor are used (see ... for details).

func (*Server) SetHTTPHandler

func (s *Server) SetHTTPHandler(fn func(m *grpc_runtime.ServeMux) http.Handler)

SetHTTPHandler allows replacing the default HTTP handler with a custom one.

The handler should not change after the server starts.

func (*Server) SetServiceBuckets

func (s *Server) SetServiceBuckets(names ...string)

SetServiceBuckets sets a list of buckets used by the gRPC Gateway server to discover and register target services for serving.

The list should not change after the server starts.

func (*Server) Start

func (s *Server) Start(ctx context.Context)

Start starts the gRPC Gateway server in a separate goroutine and does not wait for it to complete.

Use the Wait() method to wait for the server to complete and then read its exit code.

func (*Server) Wait

func (s *Server) Wait() error

Wait blocks until all goroutines started by the server have finished, then returns the first non-nil error (if any) from them.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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