Documentation ¶
Index ¶
- func Extract(hostPort string, lis net.Listener) (string, error)
- func ExtractHostPort(addr string) (host string, port uint64, err error)
- func NewEndpoint(scheme, host string, isSecure bool) *url.URL
- func Port(lis net.Listener) (int, bool)
- type ClientInter
- type ClientOptionFunc
- type RpcClient
- type RpcInter
- type RpcRegisterInter
- type RpcServer
- func (rs *RpcServer) AddGrpcOptions(options ...grpc.ServerOption)
- func (rs *RpcServer) AddStreamInterceptors(interceptors ...grpc.StreamServerInterceptor)
- func (rs *RpcServer) AddUnaryInterceptors(interceptors ...grpc.UnaryServerInterceptor)
- func (rs *RpcServer) Endpoint() (*url.URL, error)
- func (rs *RpcServer) Register(inters ...RpcRegisterInter)
- func (rs *RpcServer) Start()
- func (rs *RpcServer) Stop()
- type Server
- type SvrOptionFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractHostPort ¶
ExtractHostPort from address
func NewEndpoint ¶
NewEndpoint new an Endpoint URL.
Types ¶
type ClientInter ¶
type ClientInter interface {
Conn() *grpc.ClientConn
}
func NewClient ¶
func NewClient(target string, opts ...ClientOptionFunc) (ClientInter, error)
NewClient returns a Client.
func NewRpcClient ¶
func NewRpcClient(c *gofkConf.RpcClientConf) ClientInter
NewRpcClient returns a Client, exits on any error.
type ClientOptionFunc ¶
type ClientOptionFunc func(o *clientOptions)
func WithDialOption ¶
func WithDialOption(opt grpc.DialOption) ClientOptionFunc
func WithEndpoint ¶
func WithEndpoint(endpoint string) ClientOptionFunc
func WithNonBlock ¶
func WithNonBlock() ClientOptionFunc
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOptionFunc
WithTimeout returns a func to customize a ClientOptions with given timeout.
func WithTransportCredentials ¶
func WithTransportCredentials(creds credentials.TransportCredentials) ClientOptionFunc
WithTransportCredentials return a func to make the gRPC calls secured with given credentials.
type RpcClient ¶
type RpcClient struct {
// contains filtered or unexported fields
}
func (*RpcClient) Conn ¶
func (rc *RpcClient) Conn() *grpc.ClientConn
Conn returns the underlying grpc.ClientConn.
type RpcInter ¶
type RpcInter interface { AddGrpcOptions(options ...grpc.ServerOption) AddStreamInterceptors(interceptors ...grpc.StreamServerInterceptor) AddUnaryInterceptors(interceptors ...grpc.UnaryServerInterceptor) Start() Stop() }
type RpcRegisterInter ¶
type RpcRegisterInter interface {
RegisterServer(*Server)
}
type RpcServer ¶
type RpcServer struct {
// contains filtered or unexported fields
}
func NewRpcServer ¶
func (*RpcServer) AddGrpcOptions ¶
func (rs *RpcServer) AddGrpcOptions(options ...grpc.ServerOption)
AddGrpcOptions adds given options.
func (*RpcServer) AddStreamInterceptors ¶
func (rs *RpcServer) AddStreamInterceptors(interceptors ...grpc.StreamServerInterceptor)
AddStreamInterceptors adds given stream interceptors.
func (*RpcServer) AddUnaryInterceptors ¶
func (rs *RpcServer) AddUnaryInterceptors(interceptors ...grpc.UnaryServerInterceptor)
AddUnaryInterceptors adds given unary interceptors.
type Server ¶
type Server struct { *grpc.Server Opts *serverOption Endpoint *url.URL Registers []RpcRegisterInter // contains filtered or unexported fields }
func (*Server) AddGrpcOptions ¶
func (s *Server) AddGrpcOptions(options ...grpc.ServerOption)
func (*Server) AddStreamInterceptors ¶
func (s *Server) AddStreamInterceptors(interceptors ...grpc.StreamServerInterceptor)
func (*Server) AddUnaryInterceptors ¶
func (s *Server) AddUnaryInterceptors(interceptors ...grpc.UnaryServerInterceptor)
type SvrOptionFunc ¶
type SvrOptionFunc func(option *serverOption)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.