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 ClientOption
- func WithBalancerName(name string) ClientOption
- func WithClientOptions(opts ...grpc.DialOption) ClientOption
- func WithClientStreamInterceptor(in ...grpc.StreamClientInterceptor) ClientOption
- func WithClientTimeout(timeout time.Duration) ClientOption
- func WithClientUnaryInterceptor(in ...grpc.UnaryClientInterceptor) ClientOption
- func WithDiscovery(d registry.Discovery) ClientOption
- func WithEnableTracing(enable bool) ClientOption
- func WithEndpoint(endpoint string) ClientOption
- func WithMetric(metric metric.GrpcClientMetric) ClientOption
- type Server
- type ServerOption
- func WithAddress(address string) ServerOption
- func WithGrpcOpts(opts ...grpc.ServerOption) ServerOption
- func WithListener(lis net.Listener) ServerOption
- func WithNetwork(network string) ServerOption
- func WithStreamInterceptor(in ...grpc.StreamServerInterceptor) ServerOption
- func WithUnaryInterceptor(in ...grpc.UnaryServerInterceptor) ServerOption
- type Transport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dial ¶ added in v0.0.3
func Dial(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)
func DialInsecure ¶ added in v0.0.3
func DialInsecure(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)
func NewWrappedStream ¶
func NewWrappedStream(ctx context.Context, stream grpc.ServerStream) grpc.ServerStream
Types ¶
type ClientOption ¶ added in v0.0.3
type ClientOption func(o *clientOptions)
func WithClientOptions ¶ added in v0.0.3
func WithClientOptions(opts ...grpc.DialOption) ClientOption
设置grpc的dial选项
func WithClientStreamInterceptor ¶ added in v0.0.3
func WithClientStreamInterceptor(in ...grpc.StreamClientInterceptor) ClientOption
设置stream拦截器
func WithClientTimeout ¶ added in v0.0.3
func WithClientTimeout(timeout time.Duration) ClientOption
设置超时时间
func WithClientUnaryInterceptor ¶ added in v0.0.3
func WithClientUnaryInterceptor(in ...grpc.UnaryClientInterceptor) ClientOption
设置拦截器
func WithEnableTracing ¶ added in v0.0.3
func WithEnableTracing(enable bool) ClientOption
func WithMetric ¶ added in v0.0.3
func WithMetric(metric metric.GrpcClientMetric) ClientOption
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 WithAddress ¶
func WithAddress(address string) ServerOption
func WithGrpcOpts ¶
func WithGrpcOpts(opts ...grpc.ServerOption) ServerOption
WithGrpcOpts with grpc options.
func WithNetwork ¶
func WithNetwork(network string) ServerOption
func WithStreamInterceptor ¶
func WithStreamInterceptor(in ...grpc.StreamServerInterceptor) ServerOption
WithStreamInterceptor returns a ServerOption that sets the StreamServerInterceptor for the server.
func WithUnaryInterceptor ¶
func WithUnaryInterceptor(in ...grpc.UnaryServerInterceptor) ServerOption
WithUnaryInterceptor 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.
Click to show internal directories.
Click to hide internal directories.