package group
import "github.com/Diarkis/diarkis/proto/go/group"
Index
Constants
const BroadcastCmd uint16 = 113
BroadcastCmd represents the command ID of the protocol's command ID.
[NOTE] The value is optional and if cmd is not given in the definition JSON, it will be 0.
const BroadcastVer uint8 = 1
BroadcastVer represents the ver of the protocol's command.
[NOTE] The value is optional and if ver is not given in the definition JSON, it will be 0.
const CreateCmd uint16 = 110
CreateCmd represents the command ID of the protocol's command ID.
[NOTE] The value is optional and if cmd is not given in the definition JSON, it will be 0.
const CreateVer uint8 = 1
CreateVer represents the ver of the protocol's command.
[NOTE] The value is optional and if ver is not given in the definition JSON, it will be 0.
const JoinCmd uint16 = 111
JoinCmd represents the command ID of the protocol's command ID.
[NOTE] The value is optional and if cmd is not given in the definition JSON, it will be 0.
const JoinVer uint8 = 1
JoinVer represents the ver of the protocol's command.
[NOTE] The value is optional and if ver is not given in the definition JSON, it will be 0.
const LeaveCmd uint16 = 112
LeaveCmd represents the command ID of the protocol's command ID.
[NOTE] The value is optional and if cmd is not given in the definition JSON, it will be 0.
const LeaveVer uint8 = 1
LeaveVer represents the ver of the protocol's command.
[NOTE] The value is optional and if ver is not given in the definition JSON, it will be 0.
Types
type Broadcast
type Broadcast struct { // Command version of the protocol Ver uint8 // Command ID of the protocol Cmd uint16 // group ID GroupID string // Message to be sent as the broadcast Message []byte // If true, UDP will become RUDP Reliable bool }
Broadcast represents the command protocol data structure.
func NewBroadcast
func NewBroadcast() *Broadcast
NewBroadcast creates a new instance of Broadcast struct.
func (*Broadcast) GetCmd
func (proto *Broadcast) GetCmd() uint16
func (*Broadcast) GetVer
func (proto *Broadcast) GetVer() uint8
func (*Broadcast) Pack
func (proto *Broadcast) Pack() []byte
Pack encodes Broadcast struct to a byte array to be delivered over the command.
func (*Broadcast) PackedSize
func (proto *Broadcast) PackedSize() int
PackedSize returns the estimated packed size of the struct.
func (*Broadcast) String
func (proto *Broadcast) String() string
func (*Broadcast) Unpack
func (proto *Broadcast) Unpack(bytes []byte) error
Unpack decodes the command payload byte array to Broadcast struct.
type Create
type Create struct { // Command version of the protocol Ver uint8 // Command ID of the protocol Cmd uint16 // If true, the group will not be deleted until TTL expires even if all members leave AllowEmpty bool // If true, the creator user will join the group automatically Join bool // TTL of the group in seconds Ttl uint16 }
Create represents the command protocol data structure.
func NewCreate
func NewCreate() *Create
NewCreate creates a new instance of Create struct.
func (*Create) GetCmd
func (proto *Create) GetCmd() uint16
func (*Create) GetVer
func (proto *Create) GetVer() uint8
func (*Create) Pack
func (proto *Create) Pack() []byte
Pack encodes Create struct to a byte array to be delivered over the command.
func (*Create) PackedSize
func (proto *Create) PackedSize() int
PackedSize returns the estimated packed size of the struct.
func (*Create) String
func (proto *Create) String() string
func (*Create) Unpack
func (proto *Create) Unpack(bytes []byte) error
Unpack decodes the command payload byte array to Create struct.
type Join
type Join struct { // Command version of the protocol Ver uint8 // Command ID of the protocol Cmd uint16 // group ID GroupID string // Message to be sent when join is successful. Message []byte }
Join represents the command protocol data structure.
func NewJoin
func NewJoin() *Join
NewJoin creates a new instance of Join struct.
func (*Join) GetCmd
func (proto *Join) GetCmd() uint16
func (*Join) GetVer
func (proto *Join) GetVer() uint8
func (*Join) Pack
func (proto *Join) Pack() []byte
Pack encodes Join struct to a byte array to be delivered over the command.
func (*Join) PackedSize
func (proto *Join) PackedSize() int
PackedSize returns the estimated packed size of the struct.
func (*Join) String
func (proto *Join) String() string
func (*Join) Unpack
func (proto *Join) Unpack(bytes []byte) error
Unpack decodes the command payload byte array to Join struct.
type Leave
type Leave struct { // Command version of the protocol Ver uint8 // Command ID of the protocol Cmd uint16 // group ID GroupID string // Message to be sent when leave is successful. Message []byte }
Leave represents the command protocol data structure.
func NewLeave
func NewLeave() *Leave
NewLeave creates a new instance of Leave struct.
func (*Leave) GetCmd
func (proto *Leave) GetCmd() uint16
func (*Leave) GetVer
func (proto *Leave) GetVer() uint8
func (*Leave) Pack
func (proto *Leave) Pack() []byte
Pack encodes Leave struct to a byte array to be delivered over the command.
func (*Leave) PackedSize
func (proto *Leave) PackedSize() int
PackedSize returns the estimated packed size of the struct.
func (*Leave) String
func (proto *Leave) String() string
func (*Leave) Unpack
func (proto *Leave) Unpack(bytes []byte) error
Unpack decodes the command payload byte array to Leave struct.