Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultConfig is a default configuration. DefaultConfig = &Config{ GrpcInternalAddr: &Address{ Network: "unix", Addr: "tmp/server.sock", }, GatewayAddr: &Address{ Network: "tcp", Addr: ":3000", }, MaxConcurrentStreams: 1000, Logger: DefaultLogger, } )
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder interface { SetGrpcInternalAddr(network, addr string) Builder SetGatewayAddr(network, addr string) Builder AddGrpcServerUnaryInterceptors(interceptors ...grpc.UnaryServerInterceptor) Builder AddGrpcServerStreamInterceptors(interceptors ...grpc.StreamServerInterceptor) Builder AddGatewayServerUnaryInterceptors(interceptors ...grpc.UnaryClientInterceptor) Builder AddGatewayServerStreamInterceptors(interceptors ...grpc.StreamClientInterceptor) Builder AddRegisterGrpcServerImplFuncs(registerFuncs ...RegisterGrpcServerImplFunc) Builder AddRegisterGatewayHandlerFuncs(registerFuncs ...RegisterGatewayHandlerFunc) Builder AddGatewayMuxOptions(opts ...runtime.ServeMuxOption) Builder SetLogger(l Logger) Builder SetHTTPHeaderMapping(deciderFunc func(string) bool, mappingFunc func(string) string) Builder Validate() error Build() (*Engine, error) Serve() error }
Builder creates an engine.
type Config ¶
type Config struct { GrpcInternalAddr *Address GatewayAddr *Address RegisterGrpcServerImplFuncs []RegisterGrpcServerImplFunc RegisterGatewayHandlerFuncs []RegisterGatewayHandlerFunc GrpcServerUnaryInterceptors []grpc.UnaryServerInterceptor GrpcServerStreamInterceptors []grpc.StreamServerInterceptor GatewayServerUnaryInterceptors []grpc.UnaryClientInterceptor GatewayServerStreamInterceptors []grpc.StreamClientInterceptor GatewayMuxOptions []runtime.ServeMuxOption MaxConcurrentStreams uint32 Logger Logger HTTPHeaderMappingConfig *HTTPHeaderMappingConfig }
Config contains configurations of gRPC and Gateway server.
type GatewayServer ¶
type GatewayServer struct { *Config // contains filtered or unexported fields }
GatewayServer wraps gRPC gateway server setup process.
func (*GatewayServer) Serve ¶
func (s *GatewayServer) Serve(l net.Listener, wg *sync.WaitGroup)
Serve implements Server.Shutdown
func (*GatewayServer) Shutdown ¶
func (s *GatewayServer) Shutdown()
Shutdown implements Server.Shutdown
type GrpcServer ¶
type GrpcServer struct { *Config // contains filtered or unexported fields }
GrpcServer wraps grpc.Server setup process.
type HTTPHeaderMappingConfig ¶
type HTTPHeaderMappingConfig struct { DeciderFunc func(string) bool MapperFunc func(string) string }
HTTPHeaderMappingConfig contains functions for deciding and mapping http header keys.
type RegisterGatewayHandlerFunc ¶
RegisterGatewayHandlerFunc represents gRPC gateway's register handler functions.
type RegisterGrpcServerImplFunc ¶
RegisterGrpcServerImplFunc should register gRPC service server implementations to *grpc.Server.
type Server ¶
Server provides an interface for starting and stopping the server.
func NewGatewayServer ¶
NewGatewayServer creates GrpcServer instance.
func NewGrpcServer ¶
NewGrpcServer creates GrpcServer instance.