go-teeworlds-protocol/messages7/rcon_auth.go

51 lines
912 B
Go
Raw Normal View History

2024-06-23 04:19:27 +00:00
package messages7
import (
"slices"
"github.com/teeworlds-go/go-teeworlds-protocol/chunk7"
"github.com/teeworlds-go/go-teeworlds-protocol/network7"
"github.com/teeworlds-go/go-teeworlds-protocol/packer"
)
type RconAuth struct {
ChunkHeader *chunk7.ChunkHeader
Password string
}
func (msg *RconAuth) MsgId() int {
2024-06-23 04:19:27 +00:00
return network7.MsgSysRconAuth
}
func (msg *RconAuth) MsgType() network7.MsgType {
2024-06-23 04:19:27 +00:00
return network7.TypeNet
}
func (msg *RconAuth) System() bool {
2024-06-23 04:19:27 +00:00
return true
}
func (msg *RconAuth) Vital() bool {
2024-06-23 04:19:27 +00:00
return true
}
func (msg *RconAuth) Pack() []byte {
2024-06-23 04:19:27 +00:00
return slices.Concat(
packer.PackStr(msg.Password),
)
}
func (msg *RconAuth) Unpack(u *packer.Unpacker) error {
msg.Password, _ = u.GetString()
return nil
2024-06-23 04:19:27 +00:00
}
func (msg *RconAuth) Header() *chunk7.ChunkHeader {
return msg.ChunkHeader
}
func (msg *RconAuth) SetHeader(header *chunk7.ChunkHeader) {
msg.ChunkHeader = header
}