Documentation ¶
Index ¶
- 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 MD
- type NiceMD
- func (m NiceMD) Add(key string, value string) NiceMD
- func (m NiceMD) Clone(copiedKeys ...string) NiceMD
- func (m NiceMD) Del(key string) NiceMD
- func (m NiceMD) Get(key string) string
- func (m NiceMD) Set(key string, value string) NiceMD
- func (m NiceMD) ToIncoming(ctx context.Context) context.Context
- func (m NiceMD) ToOutgoing(ctx context.Context) context.Context
- type RpcMetadata
- func (m *RpcMetadata) DebugString() string
- func (*RpcMetadata) Descriptor() ([]byte, []int)
- func (m *RpcMetadata) GetAuthId() int64
- func (m *RpcMetadata) GetClient() string
- func (m *RpcMetadata) GetClientAddr() string
- func (m *RpcMetadata) GetClientMsgId() int64
- func (m *RpcMetadata) GetIsAdmin() bool
- func (m *RpcMetadata) GetIsBot() bool
- func (m *RpcMetadata) GetLangpack() string
- func (m *RpcMetadata) GetLayer() int32
- func (m *RpcMetadata) GetPermAuthKeyId() int64
- func (m *RpcMetadata) GetReceiveTime() int64
- func (m *RpcMetadata) GetServerId() string
- func (m *RpcMetadata) GetSessionId() int64
- func (m *RpcMetadata) GetTakeout() *Takeout
- func (m *RpcMetadata) GetTakeoutId() int64
- func (m *RpcMetadata) GetUserId() int64
- func (m *RpcMetadata) HasTakeout() bool
- func (*RpcMetadata) ProtoMessage()
- func (m *RpcMetadata) Reset()
- func (m *RpcMetadata) String() string
- func (m *RpcMetadata) XXX_DiscardUnknown()
- func (m *RpcMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *RpcMetadata) XXX_Merge(src proto.Message)
- func (m *RpcMetadata) XXX_Size() int
- func (m *RpcMetadata) XXX_Unmarshal(b []byte) error
- type Takeout
- func (*Takeout) Descriptor() ([]byte, []int)
- func (m *Takeout) GetId() int64
- func (m *Takeout) GetRange() *TakeoutMessageRange
- func (*Takeout) ProtoMessage()
- func (m *Takeout) Reset()
- func (m *Takeout) String() string
- func (m *Takeout) XXX_DiscardUnknown()
- func (m *Takeout) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Takeout) XXX_Merge(src proto.Message)
- func (m *Takeout) XXX_Size() int
- func (m *Takeout) XXX_Unmarshal(b []byte) error
- type TakeoutMessageRange
- func (*TakeoutMessageRange) Descriptor() ([]byte, []int)
- func (m *TakeoutMessageRange) GetMaxId() int32
- func (m *TakeoutMessageRange) GetMinId() int32
- func (*TakeoutMessageRange) ProtoMessage()
- func (m *TakeoutMessageRange) Reset()
- func (m *TakeoutMessageRange) String() string
- func (m *TakeoutMessageRange) XXX_DiscardUnknown()
- func (m *TakeoutMessageRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *TakeoutMessageRange) XXX_Merge(src proto.Message)
- func (m *TakeoutMessageRange) XXX_Size() int
- func (m *TakeoutMessageRange) XXX_Unmarshal(b []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RpcErrorFromMD ¶
func RpcErrorFromMD(md metadata.MD) (rpcErr *mtproto.TLRpcError)
RpcErrorFromMD Server To Client
func RpcErrorToMD ¶
func RpcErrorToMD(md *mtproto.TLRpcError) (metadata.MD, error)
func RpcMetadataToOutgoing ¶
Types ¶
type NiceMD ¶
NiceMD is a convenience wrapper definiting extra functions on the metadata.
func ExtractIncoming ¶
ExtractIncoming extracts an inbound metadata from the server-side context.
This function always returns a NiceMD wrapper of the metadata.MD, in case the context doesn't have metadata it returns a new empty NiceMD.
func ExtractOutgoing ¶
ExtractOutgoing extracts an outbound metadata from the client-side context.
This function always returns a NiceMD wrapper of the metadata.MD, in case the context doesn't have metadata it returns a new empty NiceMD.
func (NiceMD) Add ¶
Add retrieves a single value from the metadata.
It works analogously to http.Header.Add, as it appends to any existing values associated with key.
The function is binary-key safe.
func (NiceMD) Clone ¶
Clone performs a *deep* copy of the metadata.MD.
You can specify the lower-case copiedKeys to only copy certain whitelisted keys. If no keys are explicitly whitelisted all keys get copied.
func (NiceMD) Get ¶
Get retrieves a single value from the metadata.
It works analogously to http.Header.Get, returning the first value if there are many set. If the value is not set, an empty string is returned.
The function is binary-key safe.
func (NiceMD) Set ¶
Set sets the given value in a metadata.
It works analogously to http.Header.Set, overwriting all previous metadata values.
The function is binary-key safe.
func (NiceMD) ToIncoming ¶
ToIncoming sets the given NiceMD as a server-side context for dispatching.
This is mostly useful in ServerInterceptors..
type RpcMetadata ¶
type RpcMetadata struct { ServerId string `protobuf:"bytes,1,opt,name=server_id,json=serverId,proto3" json:"server_id,omitempty"` ClientAddr string `protobuf:"bytes,3,opt,name=client_addr,json=clientAddr,proto3" json:"client_addr,omitempty"` AuthId int64 `protobuf:"varint,4,opt,name=auth_id,json=authId,proto3" json:"auth_id,omitempty"` SessionId int64 `protobuf:"varint,5,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` ReceiveTime int64 `protobuf:"varint,8,opt,name=receive_time,json=receiveTime,proto3" json:"receive_time,omitempty"` // 用户ID UserId int64 `protobuf:"varint,11,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` ClientMsgId int64 `protobuf:"varint,12,opt,name=client_msg_id,json=clientMsgId,proto3" json:"client_msg_id,omitempty"` IsBot bool `protobuf:"varint,13,opt,name=is_bot,json=isBot,proto3" json:"is_bot,omitempty"` // mtproto Layer int32 `protobuf:"varint,14,opt,name=layer,proto3" json:"layer,omitempty"` Client string `protobuf:"bytes,15,opt,name=client,proto3" json:"client,omitempty"` // admin IsAdmin bool `protobuf:"varint,16,opt,name=is_admin,json=isAdmin,proto3" json:"is_admin,omitempty"` // talkeout Takeout *Takeout `protobuf:"bytes,20,opt,name=takeout,proto3" json:"takeout,omitempty"` // langpack Langpack string `protobuf:"bytes,21,opt,name=langpack,proto3" json:"langpack,omitempty"` // perm_auth_key_id PermAuthKeyId int64 `protobuf:"varint,22,opt,name=perm_auth_key_id,json=permAuthKeyId,proto3" json:"perm_auth_key_id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func RpcMetadataFromIncoming ¶
func RpcMetadataFromIncoming(ctx context.Context) *RpcMetadata
func RpcMetadataFromMD ¶
func RpcMetadataFromMD(md metadata.MD) (*RpcMetadata, error)
func (*RpcMetadata) DebugString ¶
func (m *RpcMetadata) DebugString() string
func (*RpcMetadata) Descriptor ¶
func (*RpcMetadata) Descriptor() ([]byte, []int)
func (*RpcMetadata) GetAuthId ¶
func (m *RpcMetadata) GetAuthId() int64
func (*RpcMetadata) GetClient ¶
func (m *RpcMetadata) GetClient() string
func (*RpcMetadata) GetClientAddr ¶
func (m *RpcMetadata) GetClientAddr() string
func (*RpcMetadata) GetClientMsgId ¶
func (m *RpcMetadata) GetClientMsgId() int64
func (*RpcMetadata) GetIsAdmin ¶
func (m *RpcMetadata) GetIsAdmin() bool
func (*RpcMetadata) GetIsBot ¶
func (m *RpcMetadata) GetIsBot() bool
func (*RpcMetadata) GetLangpack ¶
func (m *RpcMetadata) GetLangpack() string
func (*RpcMetadata) GetLayer ¶
func (m *RpcMetadata) GetLayer() int32
func (*RpcMetadata) GetPermAuthKeyId ¶ added in v0.141.6
func (m *RpcMetadata) GetPermAuthKeyId() int64
func (*RpcMetadata) GetReceiveTime ¶
func (m *RpcMetadata) GetReceiveTime() int64
func (*RpcMetadata) GetServerId ¶
func (m *RpcMetadata) GetServerId() string
func (*RpcMetadata) GetSessionId ¶
func (m *RpcMetadata) GetSessionId() int64
func (*RpcMetadata) GetTakeout ¶
func (m *RpcMetadata) GetTakeout() *Takeout
func (*RpcMetadata) GetTakeoutId ¶
func (m *RpcMetadata) GetTakeoutId() int64
func (*RpcMetadata) GetUserId ¶
func (m *RpcMetadata) GetUserId() int64
func (*RpcMetadata) HasTakeout ¶
func (m *RpcMetadata) HasTakeout() bool
func (*RpcMetadata) ProtoMessage ¶
func (*RpcMetadata) ProtoMessage()
func (*RpcMetadata) Reset ¶
func (m *RpcMetadata) Reset()
func (*RpcMetadata) String ¶
func (m *RpcMetadata) String() string
func (*RpcMetadata) XXX_DiscardUnknown ¶
func (m *RpcMetadata) XXX_DiscardUnknown()
func (*RpcMetadata) XXX_Marshal ¶
func (m *RpcMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*RpcMetadata) XXX_Merge ¶
func (m *RpcMetadata) XXX_Merge(src proto.Message)
func (*RpcMetadata) XXX_Size ¶
func (m *RpcMetadata) XXX_Size() int
func (*RpcMetadata) XXX_Unmarshal ¶
func (m *RpcMetadata) XXX_Unmarshal(b []byte) error
type Takeout ¶
type Takeout struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Range *TakeoutMessageRange `protobuf:"bytes,2,opt,name=range,proto3" json:"range,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Takeout) Descriptor ¶
func (*Takeout) GetRange ¶
func (m *Takeout) GetRange() *TakeoutMessageRange
func (*Takeout) ProtoMessage ¶
func (*Takeout) ProtoMessage()
func (*Takeout) XXX_DiscardUnknown ¶
func (m *Takeout) XXX_DiscardUnknown()
func (*Takeout) XXX_Marshal ¶
func (*Takeout) XXX_Unmarshal ¶
type TakeoutMessageRange ¶
type TakeoutMessageRange struct { MinId int32 `protobuf:"varint,1,opt,name=min_id,json=minId,proto3" json:"min_id,omitempty"` MaxId int32 `protobuf:"varint,2,opt,name=max_id,json=maxId,proto3" json:"max_id,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*TakeoutMessageRange) Descriptor ¶
func (*TakeoutMessageRange) Descriptor() ([]byte, []int)
func (*TakeoutMessageRange) GetMaxId ¶
func (m *TakeoutMessageRange) GetMaxId() int32
func (*TakeoutMessageRange) GetMinId ¶
func (m *TakeoutMessageRange) GetMinId() int32
func (*TakeoutMessageRange) ProtoMessage ¶
func (*TakeoutMessageRange) ProtoMessage()
func (*TakeoutMessageRange) Reset ¶
func (m *TakeoutMessageRange) Reset()
func (*TakeoutMessageRange) String ¶
func (m *TakeoutMessageRange) String() string
func (*TakeoutMessageRange) XXX_DiscardUnknown ¶
func (m *TakeoutMessageRange) XXX_DiscardUnknown()
func (*TakeoutMessageRange) XXX_Marshal ¶
func (m *TakeoutMessageRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*TakeoutMessageRange) XXX_Merge ¶
func (m *TakeoutMessageRange) XXX_Merge(src proto.Message)
func (*TakeoutMessageRange) XXX_Size ¶
func (m *TakeoutMessageRange) XXX_Size() int
func (*TakeoutMessageRange) XXX_Unmarshal ¶
func (m *TakeoutMessageRange) XXX_Unmarshal(b []byte) error