I would like to create a buffer which will contain information like nickname and password. Let's say I have created empty buffer, which is
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
By then I would like to fill it up with data, like
buffer << nickname(string) << password(string)
, so in result I'm getting
08 75 73 65 72 6e 61 6d 65 08 70 61 73 73 77 6f 72 64
which is len.nickname actual_nickname len.password password
Now, after I have created such buffer I would like to parse it to variables.
That would look like buffer >> nickname(string) >> password(string)
I made something once in c++ which was using operators, but I am not sure how to do so in Golang.
These buffers would be used as packets body in my networking app. I don't want to use structs, but kind of above.
I hope I explained my issue properly. I also do not want to use splitters like :
to get these into array table.
Thank you.