Documentation ¶
Index ¶
- func Dial(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)
- func DialInsecure(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)
- func InitBuilder()
- type ClientOption
- func WithBalancerName(name string) ClientOption
- func WithClientEnableTracing(enable bool) ClientOption
- func WithClientMetrics(enable bool) 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 WithEndpoint(endpoint string) ClientOption
- type Server
- type ServerOption
- func WithAddress(address string) ServerOption
- func WithLis(lis net.Listener) ServerOption
- func WithOptions(opts ...grpc.ServerOption) ServerOption
- func WithServerEnableTracing(ok bool) ServerOption
- func WithStreamInterceptor(in ...grpc.StreamServerInterceptor) ServerOption
- func WithTimeout(timeout time.Duration) ServerOption
- func WithUnaryInterceptor(in ...grpc.UnaryServerInterceptor) ServerOption
- func WithenableMetrics(metrics bool) ServerOption
- type Trailer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dial ¶
func Dial(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)
func DialInsecure ¶
func DialInsecure(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)
拨号
func InitBuilder ¶
func InitBuilder()
Types ¶
type ClientOption ¶
type ClientOption func(o *clientOptions)
func WithClientStreamInterceptor ¶
func WithClientStreamInterceptor(in ...grpc.StreamClientInterceptor) ClientOption
设置stream拦截器
func WithClientUnaryInterceptor ¶
func WithClientUnaryInterceptor(in ...grpc.UnaryClientInterceptor) ClientOption
设置拦截器
type Server ¶
func NewServer ¶
func NewServer(opts ...ServerOption) *Server
func (*Server) Start ¶
完成ip和port的提取
func (s *Server) listenAndEndpoint() error { if s.lis == nil { lis, err := net.Listen("tpc", s.address) if err != nil { return err } s.lis = lis } addr, err := host.Extract(s.address, s.lis) if err != nil { _ = s.lis.Close() return err } s.endpoint = &url.URL{Scheme: "grpc", Host: addr} return nil }
type ServerOption ¶
type ServerOption func(o *Server)
func WithAddress ¶
func WithAddress(address string) ServerOption
func WithLis ¶
func WithLis(lis net.Listener) ServerOption
func WithOptions ¶
func WithOptions(opts ...grpc.ServerOption) ServerOption
func WithServerEnableTracing ¶
func WithServerEnableTracing(ok bool) ServerOption
func WithStreamInterceptor ¶
func WithStreamInterceptor(in ...grpc.StreamServerInterceptor) ServerOption
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ServerOption
func WithUnaryInterceptor ¶
func WithUnaryInterceptor(in ...grpc.UnaryServerInterceptor) ServerOption
func WithenableMetrics ¶
func WithenableMetrics(metrics bool) ServerOption
Click to show internal directories.
Click to hide internal directories.