{"id":13614239,"url":"https://github.com/florianl/go-tc","last_synced_at":"2025-05-14T06:12:05.739Z","repository":{"id":35079003,"uuid":"181447452","full_name":"florianl/go-tc","owner":"florianl","description":"traffic control in pure go - it allows to read and alter queues, filters and classes","archived":false,"fork":false,"pushed_at":"2025-05-01T07:20:08.000Z","size":673,"stargazers_count":484,"open_issues_count":2,"forks_count":49,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-01T08:24:23.719Z","etag":null,"topics":["bpf","class","ebpf","filter","go","linux","network","qdisc","qos","rtnetlink","traffic-control"],"latest_commit_sha":null,"homepage":"","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/florianl.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-04-15T08:44:47.000Z","updated_at":"2025-05-01T07:20:10.000Z","dependencies_parsed_at":"2023-01-16T23:01:17.906Z","dependency_job_id":"4ccd52ab-eac6-4395-858f-f99bb060e177","html_url":"https://github.com/florianl/go-tc","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florianl%2Fgo-tc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florianl%2Fgo-tc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florianl%2Fgo-tc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florianl%2Fgo-tc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/florianl","download_url":"https://codeload.github.com/florianl/go-tc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254080135,"owners_count":22011326,"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":["bpf","class","ebpf","filter","go","linux","network","qdisc","qos","rtnetlink","traffic-control"],"created_at":"2024-08-01T20:00:58.699Z","updated_at":"2025-05-14T06:12:05.686Z","avatar_url":"https://github.com/florianl.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"tc [![PkgGoDev](https://pkg.go.dev/badge/github.com/florianl/go-tc)](https://pkg.go.dev/github.com/florianl/go-tc) [![Go Report Card](https://goreportcard.com/badge/github.com/florianl/go-tc)](https://goreportcard.com/report/github.com/florianl/go-tc) [![GitHub Actions](https://github.com/florianl/go-tc/actions/workflows/go.yml/badge.svg?branch=main)](https://github.com/florianl/go-tc/actions) [![Coverage Status](https://coveralls.io/repos/github/florianl/go-tc/badge.svg)](https://coveralls.io/github/florianl/go-tc)\n==\nThis is a work in progress version of `tc`.  It provides a [C](https://en.wikipedia.org/wiki/C_(programming_language))-binding free API to the [netlink](http://man7.org/linux/man-pages/man7/netlink.7.html) based [traffic control system](http://man7.org/linux/man-pages/man8/tc.8.html) of [rtnetlink](http://man7.org/linux/man-pages/man7/rtnetlink.7.html).\n\n## Example\n\n```golang\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net\"\n\t\"os\"\n\n\t\"github.com/mdlayher/netlink\"\n\n\t\"github.com/florianl/go-tc\"\n)\n\nfunc main() {\n\t// open a rtnetlink socket\n\trtnl, err := tc.Open(\u0026tc.Config{})\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"could not open rtnetlink socket: %v\\n\", err)\n\t\treturn\n\t}\n\tdefer func() {\n\t\tif err := rtnl.Close(); err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"could not close rtnetlink socket: %v\\n\", err)\n\t\t}\n\t}()\n\n\t// For enhanced error messages from the kernel, it is recommended to set\n\t// option `NETLINK_EXT_ACK`, which is supported since 4.12 kernel.\n\t//\n\t// If not supported, `unix.ENOPROTOOPT` is returned.\n\n\terr = rtnl.SetOption(netlink.ExtendedAcknowledge, true)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"could not set option ExtendedAcknowledge: %v\\n\", err)\n\t\treturn\n\t}\n\n\t// get all the qdiscs from all interfaces\n\tqdiscs, err := rtnl.Qdisc().Get()\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"could not get qdiscs: %v\\n\", err)\n\t\treturn\n\t}\n\n\tfor _, qdisc := range qdiscs {\n\t\tiface, err := net.InterfaceByIndex(int(qdisc.Ifindex))\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"could not get interface from id %d: %v\", qdisc.Ifindex, err)\n\t\t\treturn\n\t\t}\n\t\tfmt.Printf(\"%20s\\t%s\\n\", iface.Name, qdisc.Kind)\n\t}\n}\n```\n\n## Requirements\n\n* A version of Go that is [supported by upstream](https://golang.org/doc/devel/release.html#policy)\n\n## Privileges\n\nThis package processes information directly from the kernel and therefore it requires special privileges. You can provide this privileges by adjusting the `CAP_NET_ADMIN` capabilities.\n\n```\n\tsetcap 'cap_net_admin=+ep' /your/executable\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorianl%2Fgo-tc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflorianl%2Fgo-tc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorianl%2Fgo-tc/lists"}