gopacket get index of IP layer dynamically

57 views
Skip to first unread message

Hakan SARIMAN

unread,
Jul 5, 2022, 7:25:35 PM7/5/22
to golan...@googlegroups.com
Hi Folks,

I have a go program that reads some network packets from an interface (not using pcap).

Some of packets has 802.1Q encapsulation and some of them has not. I’m searching a way to figure out index of IP layer dynamically from whole packet.(gopacket.Packet.Bytes())

e.g. IP layer starts from 18. byte on packets has 802.1q encapsulation, and 14. bytes for other ones.

Is there a clear way to figure out the start index of IP layer?

Thanks..
--
Saygılarımla,

Hakan SARIMAN


Reply all
Reply to author
Forward
0 new messages