amaanq / bytestream

A low level look at a protocol used by a popular game company

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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"
)

func main() {
	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.


Enjoy using this!

About

A low level look at a protocol used by a popular game company

License:GNU General Public License v3.0


Languages

Language:Go 100.0%