A low level look at a protocol used by a popular game company
GoGPL-3.0
Package bytestream
This package is 100% compatible with the stdlib and mainly works with the bytes.Buffer and bytes.Reader interfaces.
Installation
go get -u github.com/amaanq/bytestream
Usage
import (
"github.com/amaanq/bytestream"
)
funcmain() {
Writer:=&bytestream.Writer{
buffer: bytes.NewBuffer([]byte{}),
}
Writer.WriteCompressedString("hello there!")
Writer.WriteInt32(40, bytestream.BigEndian)
// You've now packed hello there! and 40 into a very small byte array to do with what you please..
}
NOTE: This package is a custom protocol defined by a game company for their TCP data streams.
As such, I do not recommend using it to detect/use with protocols already implemented. However, you can use this for your own protocol for whatever it may be.
LogicLongs are now in the public domain seeing as several other public repositories explain them and showcase how to pack/unpack them.