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
- func SetGlobalBalancer(scheme string, builder selector.Builder)
- type Builder
- type ClientOption
- func WithBalancerName(name string) ClientOption
- func WithDiscovery(d registry.Discovery) ClientOption
- func WithEndpoint(endpoint string) ClientOption
- func WithFilter(filters ...selector.Filter) ClientOption
- func WithLogger(log log.Logger) ClientOption
- func WithMiddleware(m ...middleware.Middleware) ClientOption
- func WithOptions(opts ...grpc.DialOption) ClientOption
- func WithTLSConfig(c *tls.Config) ClientOption
- func WithTimeout(timeout time.Duration) ClientOption
- func WithUnaryInterceptor(in ...grpc.UnaryClientInterceptor) ClientOption
- type Picker
- type Server
- type ServerOption
- func Address(addr string) 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 Options(opts ...grpc.ServerOption) ServerOption
- func StreamInterceptor(in ...grpc.StreamServerInterceptor) ServerOption
- func TLSConfig(c *tls.Config) ServerOption
- func Timeout(timeout time.Duration) ServerOption
- func UnaryInterceptor(in ...grpc.UnaryServerInterceptor) ServerOption
- type Trailer
- type Transport
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 ¶ added in v2.1.5
func NewWrappedStream(ctx context.Context, stream grpc.ServerStream) grpc.ServerStream
func SetGlobalBalancer ¶ added in v2.1.0
SetGlobalBalancer set grpc balancer with scheme.
Types ¶
type Builder ¶ added in v2.1.0
type Builder struct {
// contains filtered or unexported fields
}
Builder is grpc balancer builder.
type ClientOption ¶
type ClientOption func(o *clientOptions)
ClientOption is gRPC client option.
func WithBalancerName ¶ added in v2.1.0
func WithBalancerName(name string) ClientOption
WithBalancerName with balancer name
func WithDiscovery ¶
func WithDiscovery(d registry.Discovery) ClientOption
WithDiscovery with client discovery.
func WithEndpoint ¶
func WithEndpoint(endpoint string) ClientOption
WithEndpoint with client endpoint.
func WithFilter ¶ added in v2.1.3
func WithFilter(filters ...selector.Filter) ClientOption
WithFilter with select filters
func WithLogger ¶ added in v2.1.3
func WithLogger(log log.Logger) ClientOption
WithLogger with logger Deprecated: use global logger instead.
func WithMiddleware ¶
func WithMiddleware(m ...middleware.Middleware) ClientOption
WithMiddleware with client middleware.
func WithOptions ¶
func WithOptions(opts ...grpc.DialOption) ClientOption
WithOptions with gRPC options.
func WithTLSConfig ¶ added in v2.0.5
func WithTLSConfig(c *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 Picker ¶ added in v2.1.0
type Picker struct {
// contains filtered or unexported fields
}
Picker is a grpc picker.
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
func (*Server) Use ¶ added in v2.4.1
func (s *Server) Use(selector string, m ...middleware.Middleware)
Use uses a service middleware with selector. selector:
- '/*'
- '/helloworld.v1.Greeter/*'
- '/helloworld.v1.Greeter/SayHello'
type ServerOption ¶
type ServerOption func(o *Server)
ServerOption is gRPC server option.
func Listener ¶ added in v2.1.4
func Listener(lis net.Listener) ServerOption
Listener with server lis
func Logger ¶
func Logger(logger log.Logger) ServerOption
Logger with server logger. Deprecated: use global logger instead.
func Middleware ¶
func Middleware(m ...middleware.Middleware) ServerOption
Middleware with server middleware.
func StreamInterceptor ¶ added in v2.1.5
func StreamInterceptor(in ...grpc.StreamServerInterceptor) ServerOption
StreamInterceptor returns a ServerOption that sets the StreamServerInterceptor for the server.
func TLSConfig ¶ added in v2.0.5
func TLSConfig(c *tls.Config) ServerOption
TLSConfig with TLS config.
func UnaryInterceptor ¶
func UnaryInterceptor(in ...grpc.UnaryServerInterceptor) ServerOption
UnaryInterceptor returns a ServerOption that sets the UnaryServerInterceptor for the server.
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport is a gRPC transport.
func (*Transport) ReplyHeader ¶
ReplyHeader returns the reply header.
func (*Transport) RequestHeader ¶
RequestHeader returns the request header.
func (*Transport) SelectFilters ¶ added in v2.1.3
SelectFilters returns the client select filters.