Documentation ¶
Overview ¶
Package grpc_util is a generated protocol buffer package.
It is generated from these files:
rpc_metadata.proto
It has these top-level messages:
RpcMetadata
Index ¶
- func BizAuthfunc(ctx context.Context) (context.Context, error)
- func BizStreamRecoveryHandler(stream grpc.ServerStream, p interface{}) (err error)
- func BizUnaryRecoveryHandler(ctx context.Context, p interface{}) (err error)
- func BizUnaryRecoveryHandler2(ctx context.Context, p interface{}) (err error)
- func NewMessageByName(mname string) (proto.Message, error)
- func NewRPCClientByServiceDiscovery(discovery *service_discovery.ServiceDiscoveryClientConfig) (c *grpc.ClientConn, err error)
- func RpcErrorFromMD(md metadata.MD) (rpcErr *mtproto.TLRpcError)
- func RpcErrorToMD(md *mtproto.TLRpcError) (metadata.MD, error)
- func RpcMetadataToOutgoing(ctx context.Context, md *RpcMetadata) (context.Context, error)
- type RPCClient
- type RPCServer
- type RegisterRPCServerFunc
- type RpcMetadata
- func (*RpcMetadata) Descriptor() ([]byte, []int)
- func (m *RpcMetadata) GetAuthId() int64
- func (m *RpcMetadata) GetClientAddr() string
- func (m *RpcMetadata) GetClientMsgId() int64
- func (m *RpcMetadata) GetExtend() *google_protobuf.Any
- func (m *RpcMetadata) GetFrom() string
- func (m *RpcMetadata) GetLayer() int32
- func (m *RpcMetadata) GetNetlibSessionId() int64
- func (m *RpcMetadata) GetReceiveTime() int64
- func (m *RpcMetadata) GetServerId() int32
- func (m *RpcMetadata) GetSessionId() int64
- func (m *RpcMetadata) GetSpanId() int64
- func (m *RpcMetadata) GetTo() string
- func (m *RpcMetadata) GetTraceId() int64
- func (m *RpcMetadata) GetUserId() int32
- func (*RpcMetadata) ProtoMessage()
- func (m *RpcMetadata) Reset()
- func (m *RpcMetadata) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BizStreamRecoveryHandler ¶
func BizStreamRecoveryHandler(stream grpc.ServerStream, p interface{}) (err error)
func BizUnaryRecoveryHandler ¶
func NewRPCClientByServiceDiscovery ¶
func NewRPCClientByServiceDiscovery(discovery *service_discovery.ServiceDiscoveryClientConfig) (c *grpc.ClientConn, err error)
func RpcErrorFromMD ¶
func RpcErrorFromMD(md metadata.MD) (rpcErr *mtproto.TLRpcError)
Server To Client
func RpcErrorToMD ¶
func RpcErrorToMD(md *mtproto.TLRpcError) (metadata.MD, error)
func RpcMetadataToOutgoing ¶
Types ¶
type RPCClient ¶
type RPCClient struct {
// contains filtered or unexported fields
}
func NewRPCClient ¶
func NewRPCClient(discovery *service_discovery.ServiceDiscoveryClientConfig) (c *RPCClient, err error)
func (*RPCClient) GetClientConn ¶
func (c *RPCClient) GetClientConn() *grpc.ClientConn
type RPCServer ¶
type RPCServer struct {
// contains filtered or unexported fields
}
func NewRpcServer ¶
func NewRpcServer(addr string, discovery *service_discovery.ServiceDiscoveryServerConfig) *RPCServer
func (*RPCServer) Serve ¶
func (s *RPCServer) Serve(regFunc RegisterRPCServerFunc)
type RegisterRPCServerFunc ¶
type func RegisterRPCServerHandler(s *grpc.Server)
type RpcMetadata ¶
type RpcMetadata struct { ServerId int32 `protobuf:"varint,1,opt,name=server_id,json=serverId" json:"server_id,omitempty"` NetlibSessionId int64 `protobuf:"varint,2,opt,name=netlib_session_id,json=netlibSessionId" json:"netlib_session_id,omitempty"` ClientAddr string `protobuf:"bytes,3,opt,name=client_addr,json=clientAddr" json:"client_addr,omitempty"` AuthId int64 `protobuf:"varint,4,opt,name=auth_id,json=authId" json:"auth_id,omitempty"` SessionId int64 `protobuf:"varint,5,opt,name=session_id,json=sessionId" json:"session_id,omitempty"` TraceId int64 `protobuf:"varint,6,opt,name=trace_id,json=traceId" json:"trace_id,omitempty"` SpanId int64 `protobuf:"varint,7,opt,name=span_id,json=spanId" json:"span_id,omitempty"` ReceiveTime int64 `protobuf:"varint,8,opt,name=receive_time,json=receiveTime" json:"receive_time,omitempty"` From string `protobuf:"bytes,9,opt,name=from" json:"from,omitempty"` To string `protobuf:"bytes,10,opt,name=to" json:"to,omitempty"` // 用户ID UserId int32 `protobuf:"varint,11,opt,name=user_id,json=userId" json:"user_id,omitempty"` ClientMsgId int64 `protobuf:"varint,12,opt,name=client_msg_id,json=clientMsgId" json:"client_msg_id,omitempty"` // mtproto Layer int32 `protobuf:"varint,13,opt,name=layer" json:"layer,omitempty"` // extend Extend *google_protobuf.Any `protobuf:"bytes,15,opt,name=extend" json:"extend,omitempty"` }
func RpcMetadataFromIncoming ¶
func RpcMetadataFromIncoming(ctx context.Context) *RpcMetadata
func RpcMetadataFromMD ¶
func RpcMetadataFromMD(md metadata.MD) (*RpcMetadata, error)
func (*RpcMetadata) Descriptor ¶
func (*RpcMetadata) Descriptor() ([]byte, []int)
func (*RpcMetadata) GetAuthId ¶
func (m *RpcMetadata) GetAuthId() int64
func (*RpcMetadata) GetClientAddr ¶
func (m *RpcMetadata) GetClientAddr() string
func (*RpcMetadata) GetClientMsgId ¶
func (m *RpcMetadata) GetClientMsgId() int64
func (*RpcMetadata) GetExtend ¶
func (m *RpcMetadata) GetExtend() *google_protobuf.Any
func (*RpcMetadata) GetFrom ¶
func (m *RpcMetadata) GetFrom() string
func (*RpcMetadata) GetLayer ¶
func (m *RpcMetadata) GetLayer() int32
func (*RpcMetadata) GetNetlibSessionId ¶
func (m *RpcMetadata) GetNetlibSessionId() int64
func (*RpcMetadata) GetReceiveTime ¶
func (m *RpcMetadata) GetReceiveTime() int64
func (*RpcMetadata) GetServerId ¶
func (m *RpcMetadata) GetServerId() int32
func (*RpcMetadata) GetSessionId ¶
func (m *RpcMetadata) GetSessionId() int64
func (*RpcMetadata) GetSpanId ¶
func (m *RpcMetadata) GetSpanId() int64
func (*RpcMetadata) GetTo ¶
func (m *RpcMetadata) GetTo() string
func (*RpcMetadata) GetTraceId ¶
func (m *RpcMetadata) GetTraceId() int64
func (*RpcMetadata) GetUserId ¶
func (m *RpcMetadata) GetUserId() int32
func (*RpcMetadata) ProtoMessage ¶
func (*RpcMetadata) ProtoMessage()
func (*RpcMetadata) Reset ¶
func (m *RpcMetadata) Reset()
func (*RpcMetadata) String ¶
func (m *RpcMetadata) String() string
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
middleware
|
|
examples/zproto
Package zproto is a generated protocol buffer package.
|
Package zproto is a generated protocol buffer package. |
recovery2
helper recovery, RecoveryHandlerFunc spit UnaryRecoveryHandlerFunc and StreamRecoveryHandlerFunc
|
helper recovery, RecoveryHandlerFunc spit UnaryRecoveryHandlerFunc and StreamRecoveryHandlerFunc |
examples/proto
Package proto is a generated protocol buffer package.
|
Package proto is a generated protocol buffer package. |
Click to show internal directories.
Click to hide internal directories.