proto

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

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

错误代码枚举

const (
	ErrorCode_NO_ERROR                ErrorCode = 0
	ErrorCode_SERVICE_NOT_FOUND       ErrorCode = 1
	ErrorCode_PROTOCOL_NOT_SUPPORTED  ErrorCode = 2
	ErrorCode_SERVICE_DISABLED        ErrorCode = 3
	ErrorCode_INVALID_PASSWORD        ErrorCode = 4
	ErrorCode_PASSWORD_REQUIRED_ERROR ErrorCode = 5
	ErrorCode_AUTH_FAILED             ErrorCode = 6
)

func (ErrorCode) Descriptor

func (ErrorCode) Descriptor() protoreflect.EnumDescriptor

func (ErrorCode) Enum

func (x ErrorCode) Enum() *ErrorCode

func (ErrorCode) EnumDescriptor deprecated

func (ErrorCode) EnumDescriptor() ([]byte, []int)

Deprecated: Use ErrorCode.Descriptor instead.

func (ErrorCode) Number

func (x ErrorCode) Number() protoreflect.EnumNumber

func (ErrorCode) String

func (x ErrorCode) String() string

func (ErrorCode) Type

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) 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

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL