Documentation ¶
Index ¶
- func Dial(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)
- func DialInsecure(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)
- func NewWrappedStream(ctx context.Context, stream grpc.ServerStream) grpc.ServerStream
- type Client
- type ClientOption
- func WithBalancerName(name string) ClientOption
- func WithDiscovery(d registry.Discovery) ClientOption
- func WithEndpoint(endpoint string) ClientOption
- func WithGrpcOptions(opts ...grpc.DialOption) ClientOption
- func WithLogger(logger log.Logger) ClientOption
- func WithMiddleware(ms ...middleware.Middleware) ClientOption
- func WithTLSConfig(conf *tls.Config) ClientOption
- func WithTimeout(timeout time.Duration) ClientOption
- func WithUnaryInterceptor(in ...grpc.UnaryClientInterceptor) ClientOption
- type Server
- type ServerOption
- func Address(addr string) ServerOption
- func GrpcOptions(opts ...grpc.ServerOption) ServerOption
- func Listener(lis net.Listener) ServerOption
- func Logger(logger log.Logger) ServerOption
- func Middleware(m ...middleware.Middleware) ServerOption
- func Network(network string) ServerOption
- func StreamInterceptor(in ...grpc.StreamServerInterceptor) ServerOption
- func TLSConfig(c *tls.Config) ServerOption
- func UnaryInterceptor(in ...grpc.UnaryServerInterceptor) ServerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dial ¶
func Dial(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)
Dial returns a GRPC connection.
func DialInsecure ¶
func DialInsecure(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)
DialInsecure returns an insecure GRPC connection.
func NewWrappedStream ¶
func NewWrappedStream(ctx context.Context, stream grpc.ServerStream) grpc.ServerStream
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is gRPC Client
type ClientOption ¶
type ClientOption func(o *Client)
ClientOption is gRPC client option.
func WithBalancerName ¶
func WithBalancerName(name string) ClientOption
WithBalancerName with balancer name
func WithDiscovery ¶
func WithDiscovery(d registry.Discovery) ClientOption
WithDiscovery with client discovery.
func WithGrpcOptions ¶
func WithGrpcOptions(opts ...grpc.DialOption) ClientOption
WithGrpcOptions with gRPC options.
func WithLogger ¶ added in v1.2.1
func WithLogger(logger log.Logger) ClientOption
WithLogger with server logger.
func WithMiddleware ¶
func WithMiddleware(ms ...middleware.Middleware) ClientOption
WithMiddleware with client middleware.
func WithTLSConfig ¶
func WithTLSConfig(conf *tls.Config) ClientOption
WithTLSConfig with TLS config.
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
WithTimeout with client timeout.
func WithUnaryInterceptor ¶
func WithUnaryInterceptor(in ...grpc.UnaryClientInterceptor) ClientOption
WithUnaryInterceptor returns a DialOption that specifies the interceptor for unary RPCs.
type Server ¶
Server is a gRPC server wrapper.
func NewServer ¶
func NewServer(opts ...ServerOption) *Server
NewServer creates a gRPC server by options.
func (*Server) Endpoint ¶
Endpoint return a real address to registry endpoint. examples:
grpc://127.0.0.1:9000?isSecure=false
type ServerOption ¶
type ServerOption func(o *Server)
ServerOption is gRPC server option.
func GrpcOptions ¶
func GrpcOptions(opts ...grpc.ServerOption) ServerOption
GrpcOptions with grpc options.
func Logger ¶ added in v1.2.1
func Logger(logger log.Logger) ServerOption
Logger with server logger.
func Middleware ¶
func Middleware(m ...middleware.Middleware) ServerOption
Middleware with server middleware.
func StreamInterceptor ¶
func StreamInterceptor(in ...grpc.StreamServerInterceptor) ServerOption
StreamInterceptor returns a ServerOption that sets the StreamServerInterceptor for the server.
func UnaryInterceptor ¶
func UnaryInterceptor(in ...grpc.UnaryServerInterceptor) ServerOption
UnaryInterceptor returns a ServerOption that sets the UnaryServerInterceptor for the server.