Documentation ¶
Index ¶
- Variables
- 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)deprecated
- func (x *RpcMetadata) GetAuthId() int64
- func (x *RpcMetadata) GetClient() string
- func (x *RpcMetadata) GetClientAddr() string
- func (x *RpcMetadata) GetClientMsgId() int64
- func (x *RpcMetadata) GetIsAdmin() bool
- func (x *RpcMetadata) GetIsBot() bool
- func (x *RpcMetadata) GetLangpack() string
- func (x *RpcMetadata) GetLayer() int32
- func (x *RpcMetadata) GetPermAuthKeyId() int64
- func (x *RpcMetadata) GetReceiveTime() int64
- func (x *RpcMetadata) GetServerId() string
- func (x *RpcMetadata) GetSessionId() int64
- func (x *RpcMetadata) GetTakeout() *Takeout
- func (m *RpcMetadata) GetTakeoutId() int64
- func (x *RpcMetadata) GetUserId() int64
- func (m *RpcMetadata) HasTakeout() bool
- func (*RpcMetadata) ProtoMessage()
- func (x *RpcMetadata) ProtoReflect() protoreflect.Message
- func (x *RpcMetadata) Reset()
- func (x *RpcMetadata) String() string
- type Takeout
- type TakeoutMessageRange
- func (*TakeoutMessageRange) Descriptor() ([]byte, []int)deprecated
- func (x *TakeoutMessageRange) GetMaxId() int32
- func (x *TakeoutMessageRange) GetMinId() int32
- func (*TakeoutMessageRange) ProtoMessage()
- func (x *TakeoutMessageRange) ProtoReflect() protoreflect.Message
- func (x *TakeoutMessageRange) Reset()
- func (x *TakeoutMessageRange) String() string
Constants ¶
This section is empty.
Variables ¶
var File_rpc_metadata_proto protoreflect.FileDescriptor
Functions ¶
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"` // contains filtered or unexported fields }
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
deprecated
func (*RpcMetadata) Descriptor() ([]byte, []int)
Deprecated: Use RpcMetadata.ProtoReflect.Descriptor instead.
func (*RpcMetadata) GetAuthId ¶
func (x *RpcMetadata) GetAuthId() int64
func (*RpcMetadata) GetClient ¶
func (x *RpcMetadata) GetClient() string
func (*RpcMetadata) GetClientAddr ¶
func (x *RpcMetadata) GetClientAddr() string
func (*RpcMetadata) GetClientMsgId ¶
func (x *RpcMetadata) GetClientMsgId() int64
func (*RpcMetadata) GetIsAdmin ¶
func (x *RpcMetadata) GetIsAdmin() bool
func (*RpcMetadata) GetIsBot ¶
func (x *RpcMetadata) GetIsBot() bool
func (*RpcMetadata) GetLangpack ¶
func (x *RpcMetadata) GetLangpack() string
func (*RpcMetadata) GetLayer ¶
func (x *RpcMetadata) GetLayer() int32
func (*RpcMetadata) GetPermAuthKeyId ¶ added in v0.141.6
func (x *RpcMetadata) GetPermAuthKeyId() int64
func (*RpcMetadata) GetReceiveTime ¶
func (x *RpcMetadata) GetReceiveTime() int64
func (*RpcMetadata) GetServerId ¶
func (x *RpcMetadata) GetServerId() string
func (*RpcMetadata) GetSessionId ¶
func (x *RpcMetadata) GetSessionId() int64
func (*RpcMetadata) GetTakeout ¶
func (x *RpcMetadata) GetTakeout() *Takeout
func (*RpcMetadata) GetTakeoutId ¶
func (m *RpcMetadata) GetTakeoutId() int64
func (*RpcMetadata) GetUserId ¶
func (x *RpcMetadata) GetUserId() int64
func (*RpcMetadata) HasTakeout ¶
func (m *RpcMetadata) HasTakeout() bool
func (*RpcMetadata) ProtoMessage ¶
func (*RpcMetadata) ProtoMessage()
func (*RpcMetadata) ProtoReflect ¶ added in v0.179.2
func (x *RpcMetadata) ProtoReflect() protoreflect.Message
func (*RpcMetadata) Reset ¶
func (x *RpcMetadata) Reset()
func (*RpcMetadata) String ¶
func (x *RpcMetadata) String() string
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"` // contains filtered or unexported fields }
func (*Takeout) Descriptor
deprecated
func (*Takeout) GetRange ¶
func (x *Takeout) GetRange() *TakeoutMessageRange
func (*Takeout) ProtoMessage ¶
func (*Takeout) ProtoMessage()
func (*Takeout) ProtoReflect ¶ added in v0.179.2
func (x *Takeout) ProtoReflect() protoreflect.Message
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"` // contains filtered or unexported fields }
func (*TakeoutMessageRange) Descriptor
deprecated
func (*TakeoutMessageRange) Descriptor() ([]byte, []int)
Deprecated: Use TakeoutMessageRange.ProtoReflect.Descriptor instead.
func (*TakeoutMessageRange) GetMaxId ¶
func (x *TakeoutMessageRange) GetMaxId() int32
func (*TakeoutMessageRange) GetMinId ¶
func (x *TakeoutMessageRange) GetMinId() int32
func (*TakeoutMessageRange) ProtoMessage ¶
func (*TakeoutMessageRange) ProtoMessage()
func (*TakeoutMessageRange) ProtoReflect ¶ added in v0.179.2
func (x *TakeoutMessageRange) ProtoReflect() protoreflect.Message
func (*TakeoutMessageRange) Reset ¶
func (x *TakeoutMessageRange) Reset()
func (*TakeoutMessageRange) String ¶
func (x *TakeoutMessageRange) String() string