diff options
Diffstat (limited to 'protocol/extension.go')
| -rw-r--r-- | protocol/extension.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/protocol/extension.go b/protocol/extension.go new file mode 100644 index 0000000..5f17cff --- /dev/null +++ b/protocol/extension.go @@ -0,0 +1,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() +} |
