Documentation ¶
Index ¶
- type ListenFunc
- type Server
- type ServerOption
- func WithLogName(name string) ServerOption
- func WithOption(opts ...grpc.ServerOption) ServerOption
- func WithStreamInterceptor(in ...grpc.StreamServerInterceptor) ServerOption
- func WithTLSConfig(c *tls.Config) ServerOption
- func WithTimeout(timeout time.Duration) ServerOption
- func WithUnaryInterceptor(in ...grpc.UnaryServerInterceptor) ServerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ListenFunc ¶
type Server ¶
Server is a gRPC server runner.
func NewServer ¶
func NewServer(lisFn ListenFunc, opts ...ServerOption) *Server
NewServer creates a gRPC server by options. Note the required listen func should not produce a TSL listener.
type ServerOption ¶
type ServerOption func(s *Server)
ServerOption is gRPC server option.
func WithLogName ¶
func WithLogName(name string) ServerOption
WithLogName returns a ServerOption that sets the logger name.
func WithOption ¶
func WithOption(opts ...grpc.ServerOption) ServerOption
WithOption returns a ServerOption that sets grpc.ServerOption for the server.
func WithStreamInterceptor ¶
func WithStreamInterceptor(in ...grpc.StreamServerInterceptor) ServerOption
WithStreamInterceptor returns a ServerOption that sets the StreamServerInterceptor for the server.
func WithTLSConfig ¶
func WithTLSConfig(c *tls.Config) ServerOption
WithTLSConfig returns a ServerOption that append grpc.Creds option with the tls.Config. If the tls.Config is nil, the returned ServerOption would do nothing.
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ServerOption
WithTimeout returns a ServerOption that config timeout.
func WithUnaryInterceptor ¶
func WithUnaryInterceptor(in ...grpc.UnaryServerInterceptor) ServerOption
WithUnaryInterceptor returns a ServerOption that sets the UnaryServerInterceptor for the server.