Re: [go-nuts] Packet parsing in Go

2020-04-22 Thread wagner riffel
On Tue, 21 Apr 2020 02:22:37 -0700 (PDT) Rakesh K R wrote: > In C, we used to typecast this array of uint8_t to predefined > structure. > This is very bad even for a C program, as soon as you dereference pointer to such structure it's an undefined behavior, and not portable even on LE

Re: [go-nuts] Packet parsing in Go

2020-04-21 Thread Rakesh K R
Application is supposed to run on docker and base image for this docker is fixed. i.e ubuntu 18 always. Looks like I need to parse slice of bytes one by one. gopacket has support for packet parsing but it dont support dlna packets. Any pointers apart from this will be helpful On Tue, 21 Apr 2020

Re: [go-nuts] Packet parsing in Go

2020-04-21 Thread Jan Mercl
On Tue, Apr 21, 2020 at 6:08 PM Rakesh K R wrote: > In C, we used to typecast this array of uint8_t to predefined structure. Go has no casts. Regardless, one can do something similar using unsafe. But then - how it's planned to deal with the situation when the machine endianess does not match

[go-nuts] Packet parsing in Go

2020-04-21 Thread Rakesh K R
Hi, I am new to Go and I am trying to parse the network packets received. In C, we used to typecast this array of uint8_t to predefined structure. Is there a way I can do this similarly in Go? or any better approach to do this in Go? i.e. I need to parse the packet to store them to respective