v2ray-core: github.com/v2ray/v2ray-core/common/serial Index | Files

package serial

import "github.com/v2ray/v2ray-core/common/serial"


Package Files

serial.go string.go typed_message.go typed_message.pb.go


var File_common_serial_typed_message_proto protoreflect.FileDescriptor

func Concat Uses

func Concat(v ...interface{}) string

Concat concatenates all input into a single string.

func GetInstance Uses

func GetInstance(messageType string) (interface{}, error)

GetInstance creates a new instance of the message with messageType.

func GetMessageType Uses

func GetMessageType(message proto.Message) string

GetMessageType returns the name of this proto Message.

func ReadUint16 Uses

func ReadUint16(reader io.Reader) (uint16, error)

ReadUint16 reads first two bytes from the reader, and then coverts them to an uint16 value.

func ToString Uses

func ToString(v interface{}) string

ToString serialize an arbitrary value into string.

func WriteUint16 Uses

func WriteUint16(writer io.Writer, value uint16) (int, error)

WriteUint16 writes an uint16 value into writer.

func WriteUint64 Uses

func WriteUint64(writer io.Writer, value uint64) (int, error)

WriteUint64 writes an uint64 value into writer.

type TypedMessage Uses

type TypedMessage struct {

    // The name of the message type, retrieved from protobuf API.
    Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
    // Serialized proto message.
    Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
    // contains filtered or unexported fields

TypedMessage is a serialized proto message along with its type name.

func ToTypedMessage Uses

func ToTypedMessage(message proto.Message) *TypedMessage

ToTypedMessage converts a proto Message into TypedMessage.

func (*TypedMessage) Descriptor Uses

func (*TypedMessage) Descriptor() ([]byte, []int)

Deprecated: Use TypedMessage.ProtoReflect.Descriptor instead.

func (*TypedMessage) GetInstance Uses

func (v *TypedMessage) GetInstance() (proto.Message, error)

GetInstance converts current TypedMessage into a proto Message.

func (*TypedMessage) GetType Uses

func (x *TypedMessage) GetType() string

func (*TypedMessage) GetValue Uses

func (x *TypedMessage) GetValue() []byte

func (*TypedMessage) ProtoMessage Uses

func (*TypedMessage) ProtoMessage()

func (*TypedMessage) ProtoReflect Uses

func (x *TypedMessage) ProtoReflect() protoreflect.Message

func (*TypedMessage) Reset Uses

func (x *TypedMessage) Reset()

func (*TypedMessage) String Uses

func (x *TypedMessage) String() string

Package serial imports 10 packages (graph) and is imported by 24 packages. Updated 2020-10-16. Refresh now. Tools for package owners.