webserver

package
v0.0.0-...-0c08822 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServerMaxReceiveMessageSize = 4 * 1024 * 1024 * 1024 // 4GB
	ServerMaxSendMessageSize    = math.MaxInt32

	ClientMaxReceiveMessageSize = 4 * 1024 * 1024 * 1024 // 4GB
	ClientMaxSendMessageSize    = math.MaxInt32
)

Variables

This section is empty.

Functions

func ClientDialOptions

func ClientDialOptions(options ...grpc.DialOption) []grpc.DialOption

func GetClientIpCtxKey

func GetClientIpCtxKey() string

func GetTracingCtxKey

func GetTracingCtxKey() string

func SetServerStatus

func SetServerStatus(status HealthStatus)

func SetTracing

func SetTracing(fieldName, fieldNameKey, ctxKey string)

SetTracing fieldName for proto field name, fieldNameKey for log key, ctxKey for context key

func UnaryClientInterceptorOfContext

func UnaryClientInterceptorOfContext() grpc.UnaryClientInterceptor

func UnaryClientInterceptorOfDebug

func UnaryClientInterceptorOfDebug() grpc.UnaryClientInterceptor

func UnaryClientInterceptorOfSessionId

func UnaryClientInterceptorOfSessionId() grpc.UnaryClientInterceptor

func UnaryServerInterceptorOfContext

func UnaryServerInterceptorOfContext() grpc.UnaryServerInterceptor

func UnaryServerInterceptorOfDebug

func UnaryServerInterceptorOfDebug() grpc.UnaryServerInterceptor

func UnaryServerInterceptorOfRecovery

func UnaryServerInterceptorOfRecovery() grpc.UnaryServerInterceptor

func UnaryServerInterceptorOfSessionId

func UnaryServerInterceptorOfSessionId() grpc.UnaryServerInterceptor

Types

type HandlerFromEndpoint

type HandlerFromEndpoint func(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) error

type ServerOption

type ServerOption func(*Webserver)

func WithAddr

func WithAddr(ip string, port int) ServerOption

func WithDialOptions

func WithDialOptions(opts ...grpc.DialOption) ServerOption

func WithGatewayOptions

func WithGatewayOptions(opts ...runtime.ServeMuxOption) ServerOption

func WithHealthz

func WithHealthz() ServerOption

func WithHealthzPath

func WithHealthzPath(path string) ServerOption

func WithPProf

func WithPProf() ServerOption

func WithPProfPath

func WithPProfPath(path string) ServerOption

func WithPort

func WithPort(port int) ServerOption

func WithReflection

func WithReflection() ServerOption

func WithServerOptions

func WithServerOptions(opts ...grpc.ServerOption) ServerOption

type Webserver

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

func NewServer

func NewServer(opts ...ServerOption) *Webserver

func (*Webserver) GatewayMux

func (s *Webserver) GatewayMux() *runtime.ServeMux

func (*Webserver) GrpcServer

func (s *Webserver) GrpcServer() *grpc.Server

func (*Webserver) HttpMux

func (s *Webserver) HttpMux() *http.ServeMux

func (*Webserver) RegisterGatewayHandlerFromEndpoint

func (s *Webserver) RegisterGatewayHandlerFromEndpoint(
	endpoint string, opts []grpc.DialOption, handlerFromEndpoint HandlerFromEndpoint,
)

func (*Webserver) RegisterGatewayHandlerWithDefault

func (s *Webserver) RegisterGatewayHandlerWithDefault(handlerFromEndpoint HandlerFromEndpoint)

func (*Webserver) RegisterGrpcServer

func (s *Webserver) RegisterGrpcServer(fn func(srv *grpc.Server))

func (*Webserver) RegisterHttpHandler

func (s *Webserver) RegisterHttpHandler(pattern string, handler http.Handler)

func (*Webserver) Serve

func (s *Webserver) Serve() error

func (*Webserver) ServeTLS

func (s *Webserver) ServeTLS() error

func (*Webserver) Stop

func (s *Webserver) Stop()

Jump to

Keyboard shortcuts

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