Import path:
gitlab.soludian.com/soludian/fountain/libs/fnet/codec
codec
import "gitlab.soludian.com/soludian/fountain/libs/fnet/codec"Index
- Constants
- Variables
- func NewMessageByName(mName string) (proto.Message, error)
- func RegisterType(x proto.Message, name string)
- type AuthProtoMeta
- func (*AuthProtoMeta) Descriptor() ([]byte, []int)
- func (x *AuthProtoMeta) GetAccessHash() string
- func (x *AuthProtoMeta) GetAuthKeyId() string
- func (x *AuthProtoMeta) GetClientAddr() string
- func (x *AuthProtoMeta) GetClientConnId() int64
- func (x *AuthProtoMeta) GetFrom() string
- func (x *AuthProtoMeta) GetLayer() int32
- func (x *AuthProtoMeta) GetMessageId() int64
- func (x *AuthProtoMeta) GetReceiveTime() int32
- func (x *AuthProtoMeta) GetServerId() string
- func (x *AuthProtoMeta) GetSessionId() string
- func (x *AuthProtoMeta) GetUserId() string
- func (*AuthProtoMeta) ProtoMessage()
- func (x *AuthProtoMeta) ProtoReflect() protoreflect.Message
- func (x *AuthProtoMeta) Reset()
- func (x *AuthProtoMeta) String() string
- type ChunkInfo
- type DefaultQUICCodec
- type DefaultTCPCodec
- type DefaultUDPCodec
- type Feedback
- type FrameType
- type InitConnection
- func (*InitConnection) Descriptor() ([]byte, []int)
- func (x *InitConnection) GetMsgId() int64
- func (x *InitConnection) GetServerName() string
- func (x *InitConnection) GetServerTime() int64
- func (*InitConnection) ProtoMessage()
- func (x *InitConnection) ProtoReflect() protoreflect.Message
- func (x *InitConnection) Reset()
- func (x *InitConnection) String() string
- type Message
- type MessageController
- func NewMessageController(parent ...*MessageController) *MessageController
- func SplitMessage(msg *Message) (*MessageController, proto.Message, error)
- func (c *MessageController) Clone() *MessageController
- func (c *MessageController) Default(x proto.Message) *MessageController
- func (c *MessageController) DefaultForQUIC(x proto.Message) *MessageController
- func (c *MessageController) GetAttachment() []byte
- func (c *MessageController) GetClientAddr() string
- func (c *MessageController) MakeMessage(msg proto.Message) *Message
- func (c *MessageController) MakeQUICMessage(msg proto.Message) *Message
- func (c *MessageController) MoveAttachment() []byte
- func (c *MessageController) SetAccessHash(v string) *MessageController
- func (c *MessageController) SetAttachment(b []byte) *MessageController
- func (c *MessageController) SetAuthKeyID(v string) *MessageController
- func (c *MessageController) SetClientAddr(v string) *MessageController
- func (c *MessageController) SetClientConnID(v int64) *MessageController
- func (c *MessageController) SetCompressType(v int32) *MessageController
- func (c *MessageController) SetCorrelationID(v int64) *MessageController
- func (c *MessageController) SetDestinationServiceName(v string) *MessageController
- func (c *MessageController) SetErrorCode(v int32) *MessageController
- func (c *MessageController) SetErrorText(v string) *MessageController
- func (c *MessageController) SetFrom(v string) *MessageController
- func (c *MessageController) SetLayer(v int32) *MessageController
- func (c *MessageController) SetMessageID(v int64) *MessageController
- func (c *MessageController) SetMethodName(msg proto.Message) *MessageController
- func (c *MessageController) SetReceiveTime(v int32) *MessageController
- func (c *MessageController) SetServerID(v string) *MessageController
- func (c *MessageController) SetSessionID(v string) *MessageController
- func (c *MessageController) SetSourceServiceName(v string) *MessageController
- func (c *MessageController) SetSpanID(uuid string) *MessageController
- func (c *MessageController) SetTraceID(uuid string) *MessageController
- func (c *MessageController) SetUserID(v string) *MessageController
- func (c *MessageController) String() string
- type MessageMeta
- func (*MessageMeta) Descriptor() ([]byte, []int)
- func (x *MessageMeta) GetAttachmentSize() int32
- func (x *MessageMeta) GetAuthenticationData() []byte
- func (x *MessageMeta) GetChunkInfo() *ChunkInfo
- func (x *MessageMeta) GetCompressType() int32
- func (x *MessageMeta) GetCorrelationId() int64
- func (x *MessageMeta) GetProtoMeta() *AuthProtoMeta
- func (x *MessageMeta) GetRequest() *RequestMeta
- func (x *MessageMeta) GetResponse() *ResponseMeta
- func (x *MessageMeta) GetStreamSettings() *StreamSettings
- func (*MessageMeta) ProtoMessage()
- func (x *MessageMeta) ProtoReflect() protoreflect.Message
- func (x *MessageMeta) Reset()
- func (x *MessageMeta) String() string
- type Ping
- type PingDelayDisconnect
- func (*PingDelayDisconnect) Descriptor() ([]byte, []int)
- func (x *PingDelayDisconnect) GetDisconnectDelay() int32
- func (x *PingDelayDisconnect) GetPingId() int64
- func (*PingDelayDisconnect) ProtoMessage()
- func (x *PingDelayDisconnect) ProtoReflect() protoreflect.Message
- func (x *PingDelayDisconnect) Reset()
- func (x *PingDelayDisconnect) String() string
- type Pong
- type Protocol
- type ProtocolFunc
- type QUICCodec
- type RequestMeta
- func (*RequestMeta) Descriptor() ([]byte, []int)
- func (x *RequestMeta) GetFromServiceName() string
- func (x *RequestMeta) GetMethodName() string
- func (x *RequestMeta) GetSpanId() string
- func (x *RequestMeta) GetToServiceName() string
- func (x *RequestMeta) GetTraceId() string
- func (m *RequestMeta) NewSpanID() *RequestMeta
- func (m *RequestMeta) NewTraceID(parent *RequestMeta) *RequestMeta
- func (*RequestMeta) ProtoMessage()
- func (x *RequestMeta) ProtoReflect() protoreflect.Message
- func (x *RequestMeta) Reset()
- func (x *RequestMeta) String() string
- type ResponseMeta
- type StreamFrameMeta
- func (*StreamFrameMeta) Descriptor() ([]byte, []int)
- func (x *StreamFrameMeta) GetFeedback() *Feedback
- func (x *StreamFrameMeta) GetFrameType() FrameType
- func (x *StreamFrameMeta) GetHasContinuation() bool
- func (x *StreamFrameMeta) GetSourceStreamId() int64
- func (x *StreamFrameMeta) GetStreamId() int64
- func (*StreamFrameMeta) ProtoMessage()
- func (x *StreamFrameMeta) ProtoReflect() protoreflect.Message
- func (x *StreamFrameMeta) Reset()
- func (x *StreamFrameMeta) String() string
- type StreamSettings
- func (*StreamSettings) Descriptor() ([]byte, []int)
- func (x *StreamSettings) GetNeedFeedback() bool
- func (x *StreamSettings) GetStreamId() int64
- func (x *StreamSettings) GetWritable() bool
- func (*StreamSettings) ProtoMessage()
- func (x *StreamSettings) ProtoReflect() protoreflect.Message
- func (x *StreamSettings) Reset()
- func (x *StreamSettings) String() string
- type TCPCodec
- type Test
- type UDPCodec
Constants
const (
KDefaultTCPCodecName = "default_tcp_codec"
KDefaultUDPCodecName = "default_udp_codec"
KDefaultQUICCodecName = "default_quic_codec"
)const (
KDefaultWriteTimeout = 5 * time.Second
)Variables
var (
// ErrorConnectionClosed indicates the connection is closed.
ErrorConnectionClosed = errors.New("connection closed")
// ErrorConnectionBlocked indicates the send channel is blocked.
ErrorConnectionBlocked = errors.New("connection blocked")
)Enum value maps for FrameType.
var (
FrameType_name = map[int32]string{
0: "FRAME_TYPE_UNKNOWN",
1: "FRAME_TYPE_RST",
2: "FRAME_TYPE_CLOSE",
3: "FRAME_TYPE_DATA",
4: "FRAME_TYPE_FEEDBACK",
}
FrameType_value = map[string]int32{
"FRAME_TYPE_UNKNOWN": 0,
"FRAME_TYPE_RST": 1,
"FRAME_TYPE_CLOSE": 2,
"FRAME_TYPE_DATA": 3,
"FRAME_TYPE_FEEDBACK": 4,
}
)var File_message_meta_proto protoreflect.FileDescriptorvar File_trans_message_proto protoreflect.FileDescriptorvar ProtoMagicNumber = []byte{'I', 'K', 'M', 'E'}func NewMessageByName
func NewMessageByName(mName string) (proto.Message, error)NewMessageByName func
func RegisterType
func RegisterType(x proto.Message, name string)RegisterType func; Register a type of object that can send or receive over ftcp;
type AuthProtoMeta
type AuthProtoMeta struct {
AuthKeyId string `protobuf:"bytes,1,opt,name=auth_key_id,json=authKeyId,proto3" json:"auth_key_id,omitempty"`
SessionId string `protobuf:"bytes,2,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
MessageId int64 `protobuf:"varint,3,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"`
Layer int32 `protobuf:"varint,4,opt,name=layer,proto3" json:"layer,omitempty"`
UserId string `protobuf:"bytes,5,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
AccessHash string `protobuf:"bytes,6,opt,name=access_hash,json=accessHash,proto3" json:"access_hash,omitempty"`
ServerId string `protobuf:"bytes,7,opt,name=server_id,json=serverId,proto3" json:"server_id,omitempty"`
ClientConnId int64 `protobuf:"varint,8,opt,name=client_conn_id,json=clientConnId,proto3" json:"client_conn_id,omitempty"`
ClientAddr string `protobuf:"bytes,9,opt,name=client_addr,json=clientAddr,proto3" json:"client_addr,omitempty"`
From string `protobuf:"bytes,10,opt,name=from,proto3" json:"from,omitempty"`
ReceiveTime int32 `protobuf:"varint,11,opt,name=receive_time,json=receiveTime,proto3" json:"receive_time,omitempty"`
// contains filtered or unexported fields
}func (*AuthProtoMeta) Descriptor
func (*AuthProtoMeta) Descriptor() ([]byte, []int)Deprecated: Use AuthProtoMeta.ProtoReflect.Descriptor instead.
func (*AuthProtoMeta) GetAccessHash
func (x *AuthProtoMeta) GetAccessHash() stringfunc (*AuthProtoMeta) GetAuthKeyId
func (x *AuthProtoMeta) GetAuthKeyId() stringfunc (*AuthProtoMeta) GetClientAddr
func (x *AuthProtoMeta) GetClientAddr() stringfunc (*AuthProtoMeta) GetClientConnId
func (x *AuthProtoMeta) GetClientConnId() int64func (*AuthProtoMeta) GetFrom
func (x *AuthProtoMeta) GetFrom() stringfunc (*AuthProtoMeta) GetLayer
func (x *AuthProtoMeta) GetLayer() int32func (*AuthProtoMeta) GetMessageId
func (x *AuthProtoMeta) GetMessageId() int64func (*AuthProtoMeta) GetReceiveTime
func (x *AuthProtoMeta) GetReceiveTime() int32func (*AuthProtoMeta) GetServerId
func (x *AuthProtoMeta) GetServerId() stringfunc (*AuthProtoMeta) GetSessionId
func (x *AuthProtoMeta) GetSessionId() stringfunc (*AuthProtoMeta) GetUserId
func (x *AuthProtoMeta) GetUserId() stringfunc (*AuthProtoMeta) ProtoMessage
func (*AuthProtoMeta) ProtoMessage()func (*AuthProtoMeta) ProtoReflect
func (x *AuthProtoMeta) ProtoReflect() protoreflect.Messagefunc (*AuthProtoMeta) Reset
func (x *AuthProtoMeta) Reset()func (*AuthProtoMeta) String
func (x *AuthProtoMeta) String() stringtype ChunkInfo
type ChunkInfo struct {
StreamId int64 `protobuf:"varint,1,opt,name=stream_id,json=streamId,proto3" json:"stream_id,omitempty"`
ChunkId int64 `protobuf:"varint,2,opt,name=chunk_id,json=chunkId,proto3" json:"chunk_id,omitempty"`
// contains filtered or unexported fields
}func (*ChunkInfo) Descriptor
func (*ChunkInfo) Descriptor() ([]byte, []int)Deprecated: Use ChunkInfo.ProtoReflect.Descriptor instead.
func (*ChunkInfo) GetChunkId
func (x *ChunkInfo) GetChunkId() int64func (*ChunkInfo) GetStreamId
func (x *ChunkInfo) GetStreamId() int64func (*ChunkInfo) ProtoMessage
func (*ChunkInfo) ProtoMessage()func (*ChunkInfo) ProtoReflect
func (x *ChunkInfo) ProtoReflect() protoreflect.Messagefunc (*ChunkInfo) Reset
func (x *ChunkInfo) Reset()func (*ChunkInfo) String
func (x *ChunkInfo) String() stringtype DefaultQUICCodec
DefaultQUICCodec implements QUICCodec interface
type DefaultQUICCodec struct {
// contains filtered or unexported fields
}func (*DefaultQUICCodec) Receive
func (c *DefaultQUICCodec) Receive() (*Message, error)func (*DefaultQUICCodec) Send
func (c *DefaultQUICCodec) Send(ctx context.Context, msg any) errormsg can be of type *Message or any other type that has encode() method or []byte
type DefaultTCPCodec
type DefaultTCPCodec struct {
*net.TCPConn
}func (*DefaultTCPCodec) Receive
func (c *DefaultTCPCodec) Receive() (*Message, error)func (*DefaultTCPCodec) Send
func (c *DefaultTCPCodec) Send(ctx context.Context, msg any) errormsg can be of type *Message or any other type that has encode() method or []byte
type DefaultUDPCodec
type DefaultUDPCodec struct {
*net.UDPConn
}func (*DefaultUDPCodec) Receive
func (c *DefaultUDPCodec) Receive() (*net.UDPAddr, *Message, error)func (*DefaultUDPCodec) Send
func (c *DefaultUDPCodec) Send(ctx context.Context, addr *net.UDPAddr, msg any) errormsg can be of type *Message or any other type that has encode() method or []byte
type Feedback
type Feedback struct {
ConsumedSize int64 `protobuf:"varint,1,opt,name=consumed_size,json=consumedSize,proto3" json:"consumed_size,omitempty"`
// contains filtered or unexported fields
}func (*Feedback) Descriptor
func (*Feedback) Descriptor() ([]byte, []int)Deprecated: Use Feedback.ProtoReflect.Descriptor instead.
func (*Feedback) GetConsumedSize
func (x *Feedback) GetConsumedSize() int64func (*Feedback) ProtoMessage
func (*Feedback) ProtoMessage()func (*Feedback) ProtoReflect
func (x *Feedback) ProtoReflect() protoreflect.Messagefunc (*Feedback) Reset
func (x *Feedback) Reset()func (*Feedback) String
func (x *Feedback) String() stringtype FrameType
type FrameType int32const (
FrameType_FRAME_TYPE_UNKNOWN FrameType = 0
FrameType_FRAME_TYPE_RST FrameType = 1
FrameType_FRAME_TYPE_CLOSE FrameType = 2
FrameType_FRAME_TYPE_DATA FrameType = 3
FrameType_FRAME_TYPE_FEEDBACK FrameType = 4
)func (FrameType) Descriptor
func (FrameType) Descriptor() protoreflect.EnumDescriptorfunc (FrameType) Enum
func (x FrameType) Enum() *FrameTypefunc (FrameType) EnumDescriptor
func (FrameType) EnumDescriptor() ([]byte, []int)Deprecated: Use FrameType.Descriptor instead.
func (FrameType) Number
func (x FrameType) Number() protoreflect.EnumNumberfunc (FrameType) String
func (x FrameType) String() stringfunc (FrameType) Type
func (FrameType) Type() protoreflect.EnumTypetype InitConnection
type InitConnection struct {
MsgId int64 `protobuf:"varint,1,opt,name=msg_id,json=msgId,proto3" json:"msg_id,omitempty"`
ServerName string `protobuf:"bytes,2,opt,name=server_name,json=serverName,proto3" json:"server_name,omitempty"`
ServerTime int64 `protobuf:"varint,3,opt,name=server_time,json=serverTime,proto3" json:"server_time,omitempty"`
// contains filtered or unexported fields
}func (*InitConnection) Descriptor
func (*InitConnection) Descriptor() ([]byte, []int)Deprecated: Use InitConnection.ProtoReflect.Descriptor instead.
func (*InitConnection) GetMsgId
func (x *InitConnection) GetMsgId() int64func (*InitConnection) GetServerName
func (x *InitConnection) GetServerName() stringfunc (*InitConnection) GetServerTime
func (x *InitConnection) GetServerTime() int64func (*InitConnection) ProtoMessage
func (*InitConnection) ProtoMessage()func (*InitConnection) ProtoReflect
func (x *InitConnection) ProtoReflect() protoreflect.Messagefunc (*InitConnection) Reset
func (x *InitConnection) Reset()func (*InitConnection) String
func (x *InitConnection) String() stringtype Message
type Message struct {
Meta *MessageMeta
Payload []byte
Attachment []byte
}func MakeMessage
func MakeMessage(cntl *MessageController, msg proto.Message) *MessageMakeTCPMessage func
func MakeQUICMessageWithController
func MakeQUICMessageWithController(cntl *MessageController, msg proto.Message) *MessageMakeQUICMessageWithController func - utility function for QUIC message creation with explicit controller
func (*Message) Encode
func (m *Message) Encode() []byteEncode exports the internal encode method for external use
type MessageController
MessageController func
type MessageController struct {
*MessageMeta
Attachment []byte
// contains filtered or unexported fields
}func NewMessageController
func NewMessageController(parent ...*MessageController) *MessageControllerNewMessageController func
func SplitMessage
func SplitMessage(msg *Message) (*MessageController, proto.Message, error)SplitMessage func
func (*MessageController) Clone
func (c *MessageController) Clone() *MessageControllerClone func
func (*MessageController) Default
func (c *MessageController) Default(x proto.Message) *MessageControllerDefault func; Create new LogID, set MethodName by proto.MesssageName, set ServiceName to default is ftcp
func (*MessageController) DefaultForQUIC
func (c *MessageController) DefaultForQUIC(x proto.Message) *MessageControllerDefaultForQUIC func; Create new LogID, set MethodName by proto.MesssageName, set ServiceName to default for QUIC
func (*MessageController) GetAttachment
func (c *MessageController) GetAttachment() []byteGetAttachment func
func (*MessageController) GetClientAddr
func (c *MessageController) GetClientAddr() stringGetClientAddr func
func (*MessageController) MakeMessage
func (c *MessageController) MakeMessage(msg proto.Message) *MessageMakeTCPMessage func
func (*MessageController) MakeQUICMessage
func (c *MessageController) MakeQUICMessage(msg proto.Message) *MessageMakeQUICMessage func - specifically for QUIC protocol message creation
func (*MessageController) MoveAttachment
func (c *MessageController) MoveAttachment() []byteMoveAttachment func
func (*MessageController) SetAccessHash
func (c *MessageController) SetAccessHash(v string) *MessageControllerSetAccessHash func
func (*MessageController) SetAttachment
func (c *MessageController) SetAttachment(b []byte) *MessageControllerSetAttachment func
func (*MessageController) SetAuthKeyID
func (c *MessageController) SetAuthKeyID(v string) *MessageControllerSetAuthKeyID func
func (*MessageController) SetClientAddr
func (c *MessageController) SetClientAddr(v string) *MessageControllerSetClientAddr func
func (*MessageController) SetClientConnID
func (c *MessageController) SetClientConnID(v int64) *MessageControllerSetClientConnID func
func (*MessageController) SetCompressType
func (c *MessageController) SetCompressType(v int32) *MessageControllerSetCompressType func
func (*MessageController) SetCorrelationID
func (c *MessageController) SetCorrelationID(v int64) *MessageControllerSetCorrelationID func
func (*MessageController) SetDestinationServiceName
func (c *MessageController) SetDestinationServiceName(v string) *MessageControllerSetDestinationServiceName func
func (*MessageController) SetErrorCode
func (c *MessageController) SetErrorCode(v int32) *MessageControllerSetErrorCode func
func (*MessageController) SetErrorText
func (c *MessageController) SetErrorText(v string) *MessageControllerSetErrorText func
func (*MessageController) SetFrom
func (c *MessageController) SetFrom(v string) *MessageControllerSetFrom func
func (*MessageController) SetLayer
func (c *MessageController) SetLayer(v int32) *MessageControllerSetLayer func
func (*MessageController) SetMessageID
func (c *MessageController) SetMessageID(v int64) *MessageControllerSetMessageID func
func (*MessageController) SetMethodName
func (c *MessageController) SetMethodName(msg proto.Message) *MessageControllerSetMethodName func
func (*MessageController) SetReceiveTime
func (c *MessageController) SetReceiveTime(v int32) *MessageControllerSetReceiveTime func
func (*MessageController) SetServerID
func (c *MessageController) SetServerID(v string) *MessageControllerSetServerID func
func (*MessageController) SetSessionID
func (c *MessageController) SetSessionID(v string) *MessageControllerSetSessionID func
func (*MessageController) SetSourceServiceName
func (c *MessageController) SetSourceServiceName(v string) *MessageControllerSetDestinationServiceName func
func (*MessageController) SetSpanID
func (c *MessageController) SetSpanID(uuid string) *MessageControllerSetSpanID func
func (*MessageController) SetTraceID
func (c *MessageController) SetTraceID(uuid string) *MessageControllerSetTraceID func
func (*MessageController) SetUserID
func (c *MessageController) SetUserID(v string) *MessageControllerSetUserID func
func (*MessageController) String
func (c *MessageController) String() stringString func
type MessageMeta
type MessageMeta struct {
Request *RequestMeta `protobuf:"bytes,1,opt,name=request,proto3" json:"request,omitempty"`
Response *ResponseMeta `protobuf:"bytes,2,opt,name=response,proto3" json:"response,omitempty"`
CompressType int32 `protobuf:"varint,3,opt,name=compress_type,json=compressType,proto3" json:"compress_type,omitempty"`
// If some requests are correlation, all of them will be have the same correlation_id
CorrelationId int64 `protobuf:"varint,4,opt,name=correlation_id,json=correlationId,proto3" json:"correlation_id,omitempty"`
AttachmentSize int32 `protobuf:"varint,5,opt,name=attachment_size,json=attachmentSize,proto3" json:"attachment_size,omitempty"`
ChunkInfo *ChunkInfo `protobuf:"bytes,6,opt,name=chunk_info,json=chunkInfo,proto3" json:"chunk_info,omitempty"`
AuthenticationData []byte `protobuf:"bytes,7,opt,name=authentication_data,json=authenticationData,proto3" json:"authentication_data,omitempty"`
StreamSettings *StreamSettings `protobuf:"bytes,8,opt,name=stream_settings,json=streamSettings,proto3" json:"stream_settings,omitempty"`
ProtoMeta *AuthProtoMeta `protobuf:"bytes,9,opt,name=proto_meta,json=protoMeta,proto3" json:"proto_meta,omitempty"`
// contains filtered or unexported fields
}func (*MessageMeta) Descriptor
func (*MessageMeta) Descriptor() ([]byte, []int)Deprecated: Use MessageMeta.ProtoReflect.Descriptor instead.
func (*MessageMeta) GetAttachmentSize
func (x *MessageMeta) GetAttachmentSize() int32func (*MessageMeta) GetAuthenticationData
func (x *MessageMeta) GetAuthenticationData() []bytefunc (*MessageMeta) GetChunkInfo
func (x *MessageMeta) GetChunkInfo() *ChunkInfofunc (*MessageMeta) GetCompressType
func (x *MessageMeta) GetCompressType() int32func (*MessageMeta) GetCorrelationId
func (x *MessageMeta) GetCorrelationId() int64func (*MessageMeta) GetProtoMeta
func (x *MessageMeta) GetProtoMeta() *AuthProtoMetafunc (*MessageMeta) GetRequest
func (x *MessageMeta) GetRequest() *RequestMetafunc (*MessageMeta) GetResponse
func (x *MessageMeta) GetResponse() *ResponseMetafunc (*MessageMeta) GetStreamSettings
func (x *MessageMeta) GetStreamSettings() *StreamSettingsfunc (*MessageMeta) ProtoMessage
func (*MessageMeta) ProtoMessage()func (*MessageMeta) ProtoReflect
func (x *MessageMeta) ProtoReflect() protoreflect.Messagefunc (*MessageMeta) Reset
func (x *MessageMeta) Reset()func (*MessageMeta) String
func (x *MessageMeta) String() stringtype Ping
type Ping struct {
PingId int64 `protobuf:"varint,1,opt,name=ping_id,json=pingId,proto3" json:"ping_id,omitempty"`
// contains filtered or unexported fields
}func (*Ping) Descriptor
func (*Ping) Descriptor() ([]byte, []int)Deprecated: Use Ping.ProtoReflect.Descriptor instead.
func (*Ping) GetPingId
func (x *Ping) GetPingId() int64func (*Ping) ProtoMessage
func (*Ping) ProtoMessage()func (*Ping) ProtoReflect
func (x *Ping) ProtoReflect() protoreflect.Messagefunc (*Ping) Reset
func (x *Ping) Reset()func (*Ping) String
func (x *Ping) String() stringtype PingDelayDisconnect
type PingDelayDisconnect struct {
PingId int64 `protobuf:"varint,1,opt,name=ping_id,json=pingId,proto3" json:"ping_id,omitempty"`
DisconnectDelay int32 `protobuf:"varint,2,opt,name=disconnect_delay,json=disconnectDelay,proto3" json:"disconnect_delay,omitempty"`
// contains filtered or unexported fields
}func (*PingDelayDisconnect) Descriptor
func (*PingDelayDisconnect) Descriptor() ([]byte, []int)Deprecated: Use PingDelayDisconnect.ProtoReflect.Descriptor instead.
func (*PingDelayDisconnect) GetDisconnectDelay
func (x *PingDelayDisconnect) GetDisconnectDelay() int32func (*PingDelayDisconnect) GetPingId
func (x *PingDelayDisconnect) GetPingId() int64func (*PingDelayDisconnect) ProtoMessage
func (*PingDelayDisconnect) ProtoMessage()func (*PingDelayDisconnect) ProtoReflect
func (x *PingDelayDisconnect) ProtoReflect() protoreflect.Messagefunc (*PingDelayDisconnect) Reset
func (x *PingDelayDisconnect) Reset()func (*PingDelayDisconnect) String
func (x *PingDelayDisconnect) String() stringtype Pong
type Pong struct {
PingId int64 `protobuf:"varint,1,opt,name=ping_id,json=pingId,proto3" json:"ping_id,omitempty"`
PongId int64 `protobuf:"varint,2,opt,name=pong_id,json=pongId,proto3" json:"pong_id,omitempty"`
// contains filtered or unexported fields
}func (*Pong) Descriptor
func (*Pong) Descriptor() ([]byte, []int)Deprecated: Use Pong.ProtoReflect.Descriptor instead.
func (*Pong) GetPingId
func (x *Pong) GetPingId() int64func (*Pong) GetPongId
func (x *Pong) GetPongId() int64func (*Pong) ProtoMessage
func (*Pong) ProtoMessage()func (*Pong) ProtoReflect
func (x *Pong) ProtoReflect() protoreflect.Messagefunc (*Pong) Reset
func (x *Pong) Reset()func (*Pong) String
func (x *Pong) String() stringtype Protocol
Protocol type
type Protocol[T any] interface {
// contains filtered or unexported methods
}type ProtocolFunc
ProtocolFunc func
type ProtocolFunc[T any] func(rw io.ReadWriter) (T, error)func (ProtocolFunc[T]) NewCodec
func (pf ProtocolFunc[T]) NewCodec(rw io.ReadWriter) (T, error)NewCodec func
type QUICCodec
QUICCodec is the message codec for QUIC streams. The wire format is identical to TCPCodec (length-prefixed Message frames), so QUICCodec is kept as a type alias to avoid duplicating method sets while still letting fquic refer to "QUICCodec" in field declarations and signatures.
type QUICCodec = TCPCodectype RequestMeta
type RequestMeta struct {
// Service name
FromServiceName string `protobuf:"bytes,1,opt,name=from_service_name,json=fromServiceName,proto3" json:"from_service_name,omitempty"`
// Service name
ToServiceName string `protobuf:"bytes,2,opt,name=to_service_name,json=toServiceName,proto3" json:"to_service_name,omitempty"`
// Service request route
MethodName string `protobuf:"bytes,3,opt,name=method_name,json=methodName,proto3" json:"method_name,omitempty"`
// uuid, trace_id id, 1 request have 1 trace_id, if the request have trace_id, don't change it
TraceId string `protobuf:"bytes,4,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"`
// span_id; when the request go to a service that can be send to some func, every func need gen new span_id
SpanId string `protobuf:"bytes,5,opt,name=span_id,json=spanId,proto3" json:"span_id,omitempty"`
// contains filtered or unexported fields
}func (*RequestMeta) Descriptor
func (*RequestMeta) Descriptor() ([]byte, []int)Deprecated: Use RequestMeta.ProtoReflect.Descriptor instead.
func (*RequestMeta) GetFromServiceName
func (x *RequestMeta) GetFromServiceName() stringfunc (*RequestMeta) GetMethodName
func (x *RequestMeta) GetMethodName() stringfunc (*RequestMeta) GetSpanId
func (x *RequestMeta) GetSpanId() stringfunc (*RequestMeta) GetToServiceName
func (x *RequestMeta) GetToServiceName() stringfunc (*RequestMeta) GetTraceId
func (x *RequestMeta) GetTraceId() stringfunc (*RequestMeta) NewSpanID
func (m *RequestMeta) NewSpanID() *RequestMetaNewSpanID func; Create new traceID and spanID
func (*RequestMeta) NewTraceID
func (m *RequestMeta) NewTraceID(parent *RequestMeta) *RequestMetaNewLogID func; Create new logID, traceID and spanID
func (*RequestMeta) ProtoMessage
func (*RequestMeta) ProtoMessage()func (*RequestMeta) ProtoReflect
func (x *RequestMeta) ProtoReflect() protoreflect.Messagefunc (*RequestMeta) Reset
func (x *RequestMeta) Reset()func (*RequestMeta) String
func (x *RequestMeta) String() stringtype ResponseMeta
type ResponseMeta struct {
ErrorCode int32 `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3" json:"error_code,omitempty"`
ErrorText string `protobuf:"bytes,2,opt,name=error_text,json=errorText,proto3" json:"error_text,omitempty"`
// contains filtered or unexported fields
}func (*ResponseMeta) Descriptor
func (*ResponseMeta) Descriptor() ([]byte, []int)Deprecated: Use ResponseMeta.ProtoReflect.Descriptor instead.
func (*ResponseMeta) GetErrorCode
func (x *ResponseMeta) GetErrorCode() int32func (*ResponseMeta) GetErrorText
func (x *ResponseMeta) GetErrorText() stringfunc (*ResponseMeta) ProtoMessage
func (*ResponseMeta) ProtoMessage()func (*ResponseMeta) ProtoReflect
func (x *ResponseMeta) ProtoReflect() protoreflect.Messagefunc (*ResponseMeta) Reset
func (x *ResponseMeta) Reset()func (*ResponseMeta) String
func (x *ResponseMeta) String() stringtype StreamFrameMeta
type StreamFrameMeta struct {
StreamId int64 `protobuf:"varint,1,opt,name=stream_id,json=streamId,proto3" json:"stream_id,omitempty"`
SourceStreamId int64 `protobuf:"varint,2,opt,name=source_stream_id,json=sourceStreamId,proto3" json:"source_stream_id,omitempty"`
FrameType FrameType `protobuf:"varint,3,opt,name=frame_type,json=frameType,proto3,enum=FrameType" json:"frame_type,omitempty"`
HasContinuation bool `protobuf:"varint,4,opt,name=has_continuation,json=hasContinuation,proto3" json:"has_continuation,omitempty"`
Feedback *Feedback `protobuf:"bytes,5,opt,name=feedback,proto3" json:"feedback,omitempty"`
// contains filtered or unexported fields
}func (*StreamFrameMeta) Descriptor
func (*StreamFrameMeta) Descriptor() ([]byte, []int)Deprecated: Use StreamFrameMeta.ProtoReflect.Descriptor instead.
func (*StreamFrameMeta) GetFeedback
func (x *StreamFrameMeta) GetFeedback() *Feedbackfunc (*StreamFrameMeta) GetFrameType
func (x *StreamFrameMeta) GetFrameType() FrameTypefunc (*StreamFrameMeta) GetHasContinuation
func (x *StreamFrameMeta) GetHasContinuation() boolfunc (*StreamFrameMeta) GetSourceStreamId
func (x *StreamFrameMeta) GetSourceStreamId() int64func (*StreamFrameMeta) GetStreamId
func (x *StreamFrameMeta) GetStreamId() int64func (*StreamFrameMeta) ProtoMessage
func (*StreamFrameMeta) ProtoMessage()func (*StreamFrameMeta) ProtoReflect
func (x *StreamFrameMeta) ProtoReflect() protoreflect.Messagefunc (*StreamFrameMeta) Reset
func (x *StreamFrameMeta) Reset()func (*StreamFrameMeta) String
func (x *StreamFrameMeta) String() stringtype StreamSettings
type StreamSettings struct {
StreamId int64 `protobuf:"varint,1,opt,name=stream_id,json=streamId,proto3" json:"stream_id,omitempty"`
NeedFeedback bool `protobuf:"varint,2,opt,name=need_feedback,json=needFeedback,proto3" json:"need_feedback,omitempty"`
Writable bool `protobuf:"varint,3,opt,name=writable,proto3" json:"writable,omitempty"`
// contains filtered or unexported fields
}func (*StreamSettings) Descriptor
func (*StreamSettings) Descriptor() ([]byte, []int)Deprecated: Use StreamSettings.ProtoReflect.Descriptor instead.
func (*StreamSettings) GetNeedFeedback
func (x *StreamSettings) GetNeedFeedback() boolfunc (*StreamSettings) GetStreamId
func (x *StreamSettings) GetStreamId() int64func (*StreamSettings) GetWritable
func (x *StreamSettings) GetWritable() boolfunc (*StreamSettings) ProtoMessage
func (*StreamSettings) ProtoMessage()func (*StreamSettings) ProtoReflect
func (x *StreamSettings) ProtoReflect() protoreflect.Messagefunc (*StreamSettings) Reset
func (x *StreamSettings) Reset()func (*StreamSettings) String
func (x *StreamSettings) String() stringtype TCPCodec
type TCPCodec interface {
Receive() (msg *Message, err error)
// msg can be of type *Message or any other type that has encode() method or []byte
Send(ctx context.Context, msg any) error
}func GetQUICCodecByName
func GetQUICCodecByName(name string) (TCPCodec, error)GetQUICCodecByName func - Note: QUIC codec requires special initialization with stream and address
func GetTCPCodecByName
func GetTCPCodecByName(name string, rw io.ReadWriter) (TCPCodec, error)GetTCPCodecByName func
func NewQUICCodec
func NewQUICCodec(conn *quic.Conn, remoteAddr net.Addr) TCPCodecNewQUICCodec creates a new QUIC codec with stream and remote address
type Test
type Test struct {
Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
CreateTime int32 `protobuf:"varint,2,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
// contains filtered or unexported fields
}func (*Test) Descriptor
func (*Test) Descriptor() ([]byte, []int)Deprecated: Use Test.ProtoReflect.Descriptor instead.
func (*Test) GetCreateTime
func (x *Test) GetCreateTime() int32func (*Test) GetMessage
func (x *Test) GetMessage() stringfunc (*Test) ProtoMessage
func (*Test) ProtoMessage()func (*Test) ProtoReflect
func (x *Test) ProtoReflect() protoreflect.Messagefunc (*Test) Reset
func (x *Test) Reset()func (*Test) String
func (x *Test) String() stringtype UDPCodec
type UDPCodec interface {
Receive() (addr *net.UDPAddr, msg *Message, err error)
// msg can be of type *Message or any other type that has encode() method or []byte
Send(ctx context.Context, addr *net.UDPAddr, msg any) error
}func GetUDPCodecByName
func GetUDPCodecByName(name string, rw io.ReadWriter) (UDPCodec, error)GetUDPCodecByName func
Generated by gomarkdoc