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 AddGatewayServerMiddleware(middlewares ...HTTPServerMiddleware) Builder AddPassedHeader(decider PassedHeaderDeciderFunc) Builder SetLogger(l Logger) 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 GatewayServerMiddlewares []HTTPServerMiddleware }
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 HTTPServerMiddleware ¶ added in v0.1.3
HTTPServerMiddleware is an interface of http server middleware
type PassedHeaderDeciderFunc ¶ added in v0.1.3
PassedHeaderDeciderFunc returns true if given header should be passed to gRPC server metadata.
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.