aboutsummaryrefslogtreecommitdiffstats
path: root/protocol/extension.go
blob: 5f17cffa76e7ffdd52cb17242f7297af3c6cc8ad (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package protocol

import (
	"fmt"

	"github.com/osm/quake/common/buffer"
)

type Extension struct {
	Version    uint32
	Extensions uint32
}

func (cmd *Extension) Bytes() []byte {
	buf := buffer.New()

	buf.PutBytes([]byte(fmt.Sprintf("0x%x", cmd.Version)))
	buf.PutBytes([]byte(fmt.Sprintf("0x%x", cmd.Extensions)))
	buf.PutByte(0x0a)

	return buf.Bytes()
}