netflow2ng icon indicating copy to clipboard operation
netflow2ng copied to clipboard

Http templates endpoint

Open kellybyrd opened this issue 3 months ago • 2 comments

Make Netflow templates available via HTTP again.

Add back the old-goflow feature to look at NF templates via an http endpoint. In order do this, I submitted a PR to the goflow2 project. Until that is merged, using a replace line in go.mod to point to my fork of goflow2 that contains the required changes for the /templates endpoint to work.

Sample output from http://a.b.c.d:8080/templates

{
    "[::ffff:172.16.1.254]:54547": {
        "2533274790396160": {
            "template-id": 256,
            "field-count": 20,
            "fields": [
                {
                    "pen-provided": false,
                    "type": 8,
                    "length": 4,
                    "pen": 0
                },
                {
                    "pen-provided": false,
                    "type": 12,
                    "length": 4,
                    "pen": 0
                },
                ...
            ]
        }
    },
    ...
}

This commit can be merged as is or left until the goflow2 folks merge my PR. I'm posting it now because it may be useful for debugging.

Bonus change: cleaned up some cruft in main() that was copied over from goflow2's main()

kellybyrd avatar Oct 11 '25 20:10 kellybyrd