{"id":13786672,"url":"https://github.com/chrispassas/nfdump","last_synced_at":"2026-01-12T06:52:30.561Z","repository":{"id":43708563,"uuid":"253949449","full_name":"chrispassas/nfdump","owner":"chrispassas","description":"NFDump File Reader","archived":false,"fork":false,"pushed_at":"2023-01-26T02:26:24.000Z","size":15363,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-19T06:48:06.069Z","etag":null,"topics":["flows","netflow","nfdump"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chrispassas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-08T01:01:22.000Z","updated_at":"2024-06-19T06:48:06.069Z","dependencies_parsed_at":"2023-02-14T13:30:30.122Z","dependency_job_id":null,"html_url":"https://github.com/chrispassas/nfdump","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrispassas%2Fnfdump","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrispassas%2Fnfdump/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrispassas%2Fnfdump/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrispassas%2Fnfdump/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrispassas","download_url":"https://codeload.github.com/chrispassas/nfdump/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213845574,"owners_count":15646795,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flows","netflow","nfdump"],"created_at":"2024-08-03T19:01:27.800Z","updated_at":"2026-01-12T06:52:30.555Z","avatar_url":"https://github.com/chrispassas.png","language":"Go","funding_links":[],"categories":["Utilities","公用事业公司","工具库","工具库`可以提升效率的通用代码库和工具`","Utility"],"sub_categories":["Utility/Miscellaneous","实用程序/Miscellaneous","查询语","Fail injection","HTTP Clients"],"readme":"# nfdump\nNFDump File Reader\n\nThis library allows Go programs to read file produced by nfdump.\n\nhttps://github.com/phaag/nfdump\n\u003e nfdump is a toolset in order to collect and process netflow and sflow data, sent from netflow/sflow compatible devices. The toolset supports netflow v1, v5/v7,v9,IPFIX and SFLOW. nfdump supports IPv4 as well as IPv6.\n\n\n## ParseReader Example\nRead whole file and return struct with all meta data and records.\n\n```go\n\npackage main\n\nimport (\n\t\"bufio\"\n\t\"log\"\n\t\"os\"\n\t\"time\"\n\n\t\"github.com/chrispassas/nfdump\"\n\n)\n\nfunc main() {\n    var filePath = \"testdata/nfcapd-small-lzo\"\n    var nff *nfdump.NFFile\n\t  var err error\n    var f *os.File\n\t  \n    f, err = os.Open(filePath)\n\t  \n    if err != nil {\n\t\t    log.Fatalf(\"[ERROR] os.Open error:%#+v\", err)\n\t  }\n\t  defer f.Close()\n    \n    var reader = bufio.NewReader(f)\n\t  nff, err = nfdump.ParseReader(reader)\n\t  \n    if err != nil {\n\t\t    log.Fatalf(\"[ERROR] nfdump.ParseReader error:%#+v\", err)\n\t  }\n    \n    for _, record := range nff.Records {\n        log.Printf(\"Received:%s routerIP:%s srcIP:%s dstIP:%s srcPort:%d dstPort:%d srcMask:%d dstMask:%d ipNextHop:%s srcAS:%d dstAS:%d\",\n        record.ReceivedTime().Format(time.RFC3339),\n\t\t\t  record.RouterIP.String(),\n\t\t\t  record.DstIP.String(),\n\t\t\t  record.SrcIP.String(),\n\t\t\t  record.SrcPort,\n\t\t\t  record.DstPort,\n\t\t\t  record.SrcMask,\n\t\t\t  record.DstMask,\n\t\t\t  record.NextHopIP.String(),\n\t\t\t  record.SrcAS,\n\t\t\t  record.DstAS,\n\t\t)\n    \n    }\n}\n\n```\n\n## StreamReader Example\nReads file one row at a time and returns records. This is generally faster and uses a lot less memory.\n\n```go\npackage main\n\nimport (\n\t\"bufio\"\n\t\"io\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/chrispassas/nfdump\"\n)\n\nfunc main() {\n\n    var filePath = \"testdata/nfcapd-large-lzo\"\n    var err error\n    var nfs *nfdump.NFStream\n    var f *os.File\n    f, err = os.Open(filePath)\n    if err != nil {\n        log.Fatalf(\"[ERROR] os.Open error:%#+v\", err)\n    }\n    defer f.Close()\n\n    var reader = bufio.NewReader(f)\n    nfs, err = nfdump.StreamReader(reader)\n    if err != nil {\n        log.Fatalf(\"[ERROR] nfdump.StreamReader error:%#+v\", err)\n    }\n    \n    var record *NFRecord\n    for {\n\tif record, err = nfs.Row(); err == io.EOF {\n\t    goto Stop\n\t} else if err != nil {\n\t    log.Printf(\"[ERROR] nfs.Row() error:%v\", err)\n\t    goto Stop\n\t}\n\n\tlog.Printf(\"Received:%s routerIP:%s srcIP:%s dstIP:%s srcPort:%d dstPort:%d srcMask:%d dstMask:%d ipNextHop:%s srcAS:%d dstAS:%d\",\n        record.ReceivedTime().Format(time.RFC3339),\n\t\t\t  record.RouterIP.String(),\n\t\t\t  record.DstIP.String(),\n\t\t\t  record.SrcIP.String(),\n\t\t\t  record.SrcPort,\n\t\t\t  record.DstPort,\n\t\t\t  record.SrcMask,\n\t\t\t  record.DstMask,\n\t\t\t  record.NextHopIP.String(),\n\t\t\t  record.SrcAS,\n\t\t\t  record.DstAS,\n\t\t)\n\n\t}\nStop:\n\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrispassas%2Fnfdump","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrispassas%2Fnfdump","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrispassas%2Fnfdump/lists"}