Documentation
¶
Index ¶
- Variables
- type ErrorCode
- type MessageType
- func (MessageType) Descriptor() protoreflect.EnumDescriptor
- func (x MessageType) Enum() *MessageType
- func (MessageType) EnumDescriptor() ([]byte, []int)deprecated
- func (x MessageType) Number() protoreflect.EnumNumber
- func (x MessageType) String() string
- func (MessageType) Type() protoreflect.EnumType
- type UnifiedMessage
- func (*UnifiedMessage) Descriptor() ([]byte, []int)deprecated
- func (x *UnifiedMessage) GetData() map[string]string
- func (x *UnifiedMessage) GetErrorCode() ErrorCode
- func (x *UnifiedMessage) GetMessage() string
- func (x *UnifiedMessage) GetPassword() string
- func (x *UnifiedMessage) GetProtocol() string
- func (x *UnifiedMessage) GetRequirePassword() bool
- func (x *UnifiedMessage) GetServiceName() string
- func (x *UnifiedMessage) GetServicePassword() string
- func (x *UnifiedMessage) GetSuccess() bool
- func (x *UnifiedMessage) GetTtlMs() uint32
- func (x *UnifiedMessage) GetType() MessageType
- func (msg *UnifiedMessage) IsShutdownMessage() bool
- func (*UnifiedMessage) ProtoMessage()
- func (x *UnifiedMessage) ProtoReflect() protoreflect.Message
- func (x *UnifiedMessage) Reset()
- func (x *UnifiedMessage) String() string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MessageType_name = map[int32]string{ 0: "PASSWORD_REQUIRED", 1: "AUTH_REQUEST", 2: "AUTH_RESPONSE", 3: "SERVICE_REQUEST", 4: "SERVICE_RESPONSE", 5: "SERVER_SHUTDOWN", 6: "CLIENT_SHUTDOWN", 7: "HEARTBEAT", } MessageType_value = map[string]int32{ "PASSWORD_REQUIRED": 0, "AUTH_REQUEST": 1, "AUTH_RESPONSE": 2, "SERVICE_REQUEST": 3, "SERVICE_RESPONSE": 4, "SERVER_SHUTDOWN": 5, "CLIENT_SHUTDOWN": 6, "HEARTBEAT": 7, } )
Enum value maps for MessageType.
View Source
var ( ErrorCode_name = map[int32]string{ 0: "NO_ERROR", 1: "SERVICE_NOT_FOUND", 2: "PROTOCOL_NOT_SUPPORTED", 3: "SERVICE_DISABLED", 4: "INVALID_PASSWORD", 5: "PASSWORD_REQUIRED_ERROR", 6: "AUTH_FAILED", } ErrorCode_value = map[string]int32{ "NO_ERROR": 0, "SERVICE_NOT_FOUND": 1, "PROTOCOL_NOT_SUPPORTED": 2, "SERVICE_DISABLED": 3, "INVALID_PASSWORD": 4, "PASSWORD_REQUIRED_ERROR": 5, "AUTH_FAILED": 6, } )
Enum value maps for ErrorCode.
View Source
var File_proto_messages_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type ErrorCode ¶
type ErrorCode int32
错误代码枚举
func (ErrorCode) Descriptor ¶
func (ErrorCode) Descriptor() protoreflect.EnumDescriptor
func (ErrorCode) EnumDescriptor
deprecated
func (ErrorCode) Number ¶
func (x ErrorCode) Number() protoreflect.EnumNumber
func (ErrorCode) Type ¶
func (ErrorCode) Type() protoreflect.EnumType
type MessageType ¶
type MessageType int32
统一的消息类型
const ( MessageType_PASSWORD_REQUIRED MessageType = 0 MessageType_AUTH_REQUEST MessageType = 1 MessageType_AUTH_RESPONSE MessageType = 2 MessageType_SERVICE_REQUEST MessageType = 3 MessageType_SERVICE_RESPONSE MessageType = 4 MessageType_SERVER_SHUTDOWN MessageType = 5 MessageType_CLIENT_SHUTDOWN MessageType = 6 MessageType_HEARTBEAT MessageType = 7 )
func (MessageType) Descriptor ¶
func (MessageType) Descriptor() protoreflect.EnumDescriptor
func (MessageType) Enum ¶
func (x MessageType) Enum() *MessageType
func (MessageType) EnumDescriptor
deprecated
func (MessageType) EnumDescriptor() ([]byte, []int)
Deprecated: Use MessageType.Descriptor instead.
func (MessageType) Number ¶
func (x MessageType) Number() protoreflect.EnumNumber
func (MessageType) String ¶
func (x MessageType) String() string
func (MessageType) Type ¶
func (MessageType) Type() protoreflect.EnumType
type UnifiedMessage ¶
type UnifiedMessage struct {
Type MessageType `protobuf:"varint,1,opt,name=type,proto3,enum=p2pforward.MessageType" json:"type,omitempty"`
// 认证相关字段
Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
Success bool `protobuf:"varint,3,opt,name=success,proto3" json:"success,omitempty"`
RequirePassword bool `protobuf:"varint,4,opt,name=require_password,json=requirePassword,proto3" json:"require_password,omitempty"`
// 服务请求相关字段
ServiceName string `protobuf:"bytes,5,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"`
Protocol string `protobuf:"bytes,6,opt,name=protocol,proto3" json:"protocol,omitempty"`
ServicePassword string `protobuf:"bytes,7,opt,name=service_password,json=servicePassword,proto3" json:"service_password,omitempty"`
// 通用字段
Message string `protobuf:"bytes,8,opt,name=message,proto3" json:"message,omitempty"`
ErrorCode ErrorCode `protobuf:"varint,9,opt,name=error_code,json=errorCode,proto3,enum=p2pforward.ErrorCode" json:"error_code,omitempty"`
Data map[string]string `` /* 136-byte string literal not displayed */
// 消息 TTL (毫秒). 0 表示使用默认 30_000ms。发送端禁止超过 60_000ms。
TtlMs uint32 `protobuf:"varint,11,opt,name=ttl_ms,json=ttlMs,proto3" json:"ttl_ms,omitempty"`
// contains filtered or unexported fields
}
统一的消息结构
func (*UnifiedMessage) Descriptor
deprecated
func (*UnifiedMessage) Descriptor() ([]byte, []int)
Deprecated: Use UnifiedMessage.ProtoReflect.Descriptor instead.
func (*UnifiedMessage) GetData ¶
func (x *UnifiedMessage) GetData() map[string]string
func (*UnifiedMessage) GetErrorCode ¶
func (x *UnifiedMessage) GetErrorCode() ErrorCode
func (*UnifiedMessage) GetMessage ¶
func (x *UnifiedMessage) GetMessage() string
func (*UnifiedMessage) GetPassword ¶
func (x *UnifiedMessage) GetPassword() string
func (*UnifiedMessage) GetProtocol ¶
func (x *UnifiedMessage) GetProtocol() string
func (*UnifiedMessage) GetRequirePassword ¶
func (x *UnifiedMessage) GetRequirePassword() bool
func (*UnifiedMessage) GetServiceName ¶
func (x *UnifiedMessage) GetServiceName() string
func (*UnifiedMessage) GetServicePassword ¶
func (x *UnifiedMessage) GetServicePassword() string
func (*UnifiedMessage) GetSuccess ¶
func (x *UnifiedMessage) GetSuccess() bool
func (*UnifiedMessage) GetTtlMs ¶
func (x *UnifiedMessage) GetTtlMs() uint32
func (*UnifiedMessage) GetType ¶
func (x *UnifiedMessage) GetType() MessageType
func (*UnifiedMessage) IsShutdownMessage ¶
func (msg *UnifiedMessage) IsShutdownMessage() bool
IsShutdownMessage checks whether the message is a shutdown notification from either side.
func (*UnifiedMessage) ProtoMessage ¶
func (*UnifiedMessage) ProtoMessage()
func (*UnifiedMessage) ProtoReflect ¶
func (x *UnifiedMessage) ProtoReflect() protoreflect.Message
func (*UnifiedMessage) Reset ¶
func (x *UnifiedMessage) Reset()
func (*UnifiedMessage) String ¶
func (x *UnifiedMessage) String() string
Click to show internal directories.
Click to hide internal directories.