phaag / go-nfdump

go-nfdump: A Go module to read and process nfdump files
BSD 2-Clause "Simplified" License
7 stars 1 forks source link

Quick way to determine if a record is v4 or v6 #3

Closed gabrielmocan closed 1 year ago

gabrielmocan commented 1 year ago

I was thinking of something like record.Type() to tell if current record being processed is v4 or v6. I want to store v4/v6 records in different structs.

phaag commented 1 year ago

I would propose record.IsIPv4() and record.IsIPv6(). We could introduce record.Type() as well, but would reserve it for the type of record, such as Event, Netflow, Sflow

gabrielmocan commented 1 year ago

This is getting awesome! Insane gains compared to calling CLI in code. Thanks @phaag

phaag commented 1 year ago

Happy, it works!!