Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/florianl/go-conntrack
c-binding free API for golang to communicate with the conntrack subsystem
https://github.com/florianl/go-conntrack
api conntrack golang linux netlink-sockets
Last synced: 11 days ago
JSON representation
c-binding free API for golang to communicate with the conntrack subsystem
- Host: GitHub
- URL: https://github.com/florianl/go-conntrack
- Owner: florianl
- License: mit
- Created: 2018-07-03T19:29:51.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-04-01T09:37:52.000Z (7 months ago)
- Last Synced: 2024-06-18T14:05:10.288Z (5 months ago)
- Topics: api, conntrack, golang, linux, netlink-sockets
- Language: Go
- Homepage:
- Size: 210 KB
- Stars: 137
- Watchers: 5
- Forks: 23
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
go-conntrack [![PkgGoDev](https://pkg.go.dev/badge/github.com/florianl/go-conntrack)](https://pkg.go.dev/github.com/florianl/go-conntrack) [![Go Report Card](https://goreportcard.com/badge/github.com/florianl/go-conntrack)](https://goreportcard.com/report/github.com/florianl/go-conntrack) [![Go](https://github.com/florianl/go-conntrack/actions/workflows/go.yml/badge.svg)](https://github.com/florianl/go-conntrack/actions/workflows/go.yml)
============This is `go-conntrack` and it is written in [golang](https://golang.org/). It provides a [C](https://en.wikipedia.org/wiki/C_(programming_language))-binding free API to the conntrack subsystem of the [Linux kernel](https://www.kernel.org).
## Example
```golang
package mainimport (
"fmt""github.com/florianl/go-conntrack"
)func main() {
nfct, err := conntrack.Open(&conntrack.Config{})
if err != nil {
fmt.Println("could not create nfct:", err)
return
}
defer nfct.Close()// Get all IPv4 entries of the expected table.
sessions, err := nfct.Dump(conntrack.Expected, conntrack.IPv4)
if err != nil {
fmt.Println("could not dump sessions:", err)
return
}// Print out all expected sessions.
for _, session := range sessions {
fmt.Printf("%#v\n", session)
}
}
```## Requirements
* A version of Go that is [supported by upstream](https://golang.org/doc/devel/release.html#policy)