Documentation ¶
Index ¶
- Constants
- func GrpcClientInit(config RpcClientConfig) (*grpc.ClientConn, error)
- func GrpcServerInit(config RpcServerConfig) (*grpc.Server, error)
- func RegisterRpcKeepalive(rpcKeepalive *RpcKeepalive, call RpcKeepaliveCall) error
- func SetRpcStreamClientHeader(data []byte) context.Context
- type RpcBaseConfig
- type RpcClientConfig
- type RpcContext
- type RpcKeepalive
- type RpcKeepaliveCall
- type RpcServerConfig
- type RpcStream
- func (rpc *RpcStream) Close(immediately bool)
- func (rpc *RpcStream) GetBindVal() interface{}
- func (rpc *RpcStream) GetRpcContext() RpcContext
- func (rpc *RpcStream) GrpcStreamClientRun(stream grpc.ClientStream) error
- func (rpc *RpcStream) GrpcStreamServerRun(stream grpc.ServerStream) error
- func (rpc *RpcStream) SendData(data interface{})
- func (rpc *RpcStream) WriteRpcStreamClientHeader(data []byte)
- func (rpc *RpcStream) WriteRpcStreamServerHeader(data []byte)
- type RpcStreamCall
Constants ¶
View Source
const ConstRpcHeader = "rpc-header-bin"
metadata如果要传输二进制数据,key必须以bin结尾
View Source
const ConstRpcStreamClientHeader = "rpc-stream-client-header-bin"
metadata如果要传输二进制数据,key必须以bin结尾
View Source
const ConstRpcStreamServerHeader = "rpc-stream-server-header-bin"
View Source
const ConstRpcStreamServerTrailer = "rpc-stream-server-trailer-bin"
Variables ¶
This section is empty.
Functions ¶
func GrpcClientInit ¶
func GrpcClientInit(config RpcClientConfig) (*grpc.ClientConn, error)
func GrpcServerInit ¶
func GrpcServerInit(config RpcServerConfig) (*grpc.Server, error)
func RegisterRpcKeepalive ¶
func RegisterRpcKeepalive(rpcKeepalive *RpcKeepalive, call RpcKeepaliveCall) error
func SetRpcStreamClientHeader ¶
设置Rpc流元数据
Types ¶
type RpcBaseConfig ¶
type RpcClientConfig ¶
type RpcClientConfig struct { RpcBaseConfig CertName string Header []byte ConnectTimeOut time.Duration ClientOption []grpc.DialOption }
type RpcContext ¶
type RpcKeepalive ¶
type RpcKeepalive struct { Data interface{} Conn *grpc.ClientConn KeepaliveTime time.Duration // contains filtered or unexported fields }
func (*RpcKeepalive) Close ¶
func (rpc *RpcKeepalive) Close()
type RpcKeepaliveCall ¶
type RpcKeepaliveCall interface { RpcServeConnected(client *RpcKeepalive, isReConnect bool) RpcServeDisconnected(client *RpcKeepalive, isCloseByUser bool) }
type RpcServerConfig ¶
type RpcServerConfig struct { RpcBaseConfig PrivateKeyPath string RegisterCall func(*grpc.Server) LogWrite io.Writer ServerOption []grpc.ServerOption }
type RpcStream ¶
type RpcStream struct {
// contains filtered or unexported fields
}
func GrpcStreamClientInit ¶
func GrpcStreamClientInit(recvMsgProto proto.Message, call RpcStreamCall) (*RpcStream, error)
初始化rpc流客户端
func GrpcStreamServerInit ¶
func GrpcStreamServerInit(stream grpc.ServerStream, recvMsgProto proto.Message, call RpcStreamCall) (*RpcStream, error)
初始化rpc流服务
func (*RpcStream) GrpcStreamClientRun ¶
func (rpc *RpcStream) GrpcStreamClientRun(stream grpc.ClientStream) error
运行rpc流客户端
func (*RpcStream) GrpcStreamServerRun ¶
func (rpc *RpcStream) GrpcStreamServerRun(stream grpc.ServerStream) error
运行rpc流服务
func (*RpcStream) WriteRpcStreamClientHeader ¶
设置rpc流客户端数据
func (*RpcStream) WriteRpcStreamServerHeader ¶
设置rpc流客户端数据
type RpcStreamCall ¶
Click to show internal directories.
Click to hide internal directories.