infragrpcserver

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultGrpcGatewayListenAddress        = ":8081"
	DefaultGrpcGatewayForwardToAddress     = "127.0.0.1:9091"
	DefaultGrpcGatewayMaxCallRecvMsgSizeMB = 0
	DefaultGrpcGatewayMaxCallSendMsgSizeMB = 0
)
View Source
const DefaultGrpcCapacity = GrpcCapacityUnlimited
View Source
const DefaultGrpcListenAddress = ":9091"
View Source
const GrpcCapacityUnlimited = 0

Variables

This section is empty.

Functions

func DefaultMuxOptions

func DefaultMuxOptions() []runtime.ServeMuxOption

func MuxOptionCustomErrorHandler

func MuxOptionCustomErrorHandler() runtime.ServeMuxOption

func MuxOptionCustomMarshaler

func MuxOptionCustomMarshaler() runtime.ServeMuxOption

Types

type Gateway

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

func NewGateway

func NewGateway(cfg *GrpcGatewayConfig, startupFunc GatewayStartupFunc, gwMuxOptions ...runtime.ServeMuxOption) *Gateway

NewGateway creates a new Grpc Gateway server

func (*Gateway) Context

func (s *Gateway) Context() context.Context

func (*Gateway) Mux

func (s *Gateway) Mux() *runtime.ServeMux

func (*Gateway) Start

func (s *Gateway) Start(_ context.Context) error

Start starts listening Grpc Gateway server and blocks until it exit.

func (*Gateway) Stop

func (s *Gateway) Stop(ctx context.Context) error

type GatewayStartupFunc

type GatewayStartupFunc func(gw *Gateway, endpoint string, dialOptions []grpc.DialOption) http.Handler

type Grpc

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

func NewGrpc

func NewGrpc(cfg *GrpcConfig, opts ...grpc.ServerOption) *Grpc

NewGrpc creates a new Grpc server

func (*Grpc) Registrar

func (s *Grpc) Registrar() grpc.ServiceRegistrar

func (*Grpc) Start

func (s *Grpc) Start(_ context.Context) error

Start starts listening Grpc server and blocks until it exit.

func (*Grpc) Stop

func (s *Grpc) Stop(ctx context.Context) error

type GrpcConfig

type GrpcConfig struct {
	Listen            string         `mapstructure:"listen"`
	Capacity          int            `mapstructure:"capacity"`
	ReflectionEnabled bool           `mapstructure:"reflection_enabled"`
	GrpcWeb           *GrpcWebConfig `mapstructure:"grpc_web"`
}

func DefaultGrpcConfig

func DefaultGrpcConfig() *GrpcConfig

func (*GrpcConfig) Validate

func (c *GrpcConfig) Validate() error

type GrpcGatewayConfig

type GrpcGatewayConfig struct {
	Listen               string `mapstructure:"listen"`
	ForwardTo            string `mapstructure:"forward_to"`
	MaxCallRecvMsgSizeMB int    `mapstructure:"max_call_recv_msg_size_mb"`
	MaxCallSendMsgSizeMB int    `mapstructure:"max_call_send_msg_size_mb"`
}

func DefaultGrpcGatewayConfig

func DefaultGrpcGatewayConfig() *GrpcGatewayConfig

func (*GrpcGatewayConfig) Validate

func (c *GrpcGatewayConfig) Validate() error

type GrpcWebConfig

type GrpcWebConfig struct {
	Listen string `mapstructure:"listen"`
}

func (*GrpcWebConfig) Validate

func (c *GrpcWebConfig) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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