-
-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Weird Number Encodings #35
Comments
Can you link to a protocol document or RFC describing these?
|
I'm trying to develop a client for Boom Beach. Information about the protocol used for this game and other games made by supercell can be found here. The length field is 3 bytes long (big endian). I've currently been decoding it by appending an empty byte to the front then converting it to an integer. I would like to use your library to handle all the encoding/decoding code but I can't because of this. Thanks! |
I think the solution here is to support unknown types via custom Maybe with signatures like this:
Then you'd just define something like: (EDIT: if you're from the future, this type was not the final API. Use Int3 here)
Pack uses a
Honestly I could also use this on some common types to get nice performance improvements by reducing reflection. |
This sounds like a good way to make the library more usable and maintainable. I'm looking forward to the implementation. |
Try 18d5282 with sample code for Int3 at the top of https://github.com/lunixbochs/struc/blob/master/custom_test.go |
Thanks, but I can't seem to use the
|
I added a unit test for |
I've found numbers in network protocols which are 3 or 5 bytes long and decoding them is hard.
The text was updated successfully, but these errors were encountered: