Skip to content
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

FlowDirection is commented out #369

Open
fionera opened this issue Jan 3, 2025 · 4 comments
Open

FlowDirection is commented out #369

fionera opened this issue Jan 3, 2025 · 4 comments

Comments

@fionera
Copy link

fionera commented Jan 3, 2025

Currently the FlowDirection field is missing in the proto file because it was commented out

//uint32 flow_direction = 42;

@lspgn
Copy link
Member

lspgn commented Jan 4, 2025

Hi @fionera
Thank you for raising the issue.

In an effort to reduce some fields that were only available in NetFlow/IPFIX, I ended up making flow direction configurable via the mapping file.

protobuf: # manual protobuf fields addition
- name: flow_direction
index: 42
type: varint

The following should automatically add the direction

goflow2 -mapping mapping.yaml

Please note that v2.2.0 made some changes to the producer libraries to support custom parsing more programmatically.

Don't hesitate if you have more questions

@fionera
Copy link
Author

fionera commented Jan 5, 2025

I am using goflow as a library including the protofile. Is there any documentation on how to use this new way?

@lspgn
Copy link
Member

lspgn commented Jan 5, 2025

Unfortunately, I didn't get around to write proper documentation.

But in short:

You need to use a TemplateMapper implementation.

To be passed to ConvertNetFlowDataSet function that decodes NetFlow/IPFIX.

Or if you want to call CreateProtoProducer, you need to use ProtoProducerConfig which wraps a TemplateMapper.

The CLI/app does a YAML configuration conversion to a structure with the Compile function but the recent changes were to make this more abstracted.

@fionera
Copy link
Author

fionera commented Jan 5, 2025

In my case I create the flow proto struct manually https://github.com/monogon-dev/NetMeta/blob/main/cmd/portmirror/iface.go#L135. So I guess CreateProtoProducer would be the way to go?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants