{"id":27253449,"url":"https://github.com/marselester/libbpf-tools","last_synced_at":"2025-04-11T01:27:40.336Z","repository":{"id":45985745,"uuid":"367161697","full_name":"marselester/libbpf-tools","owner":"marselester","description":"Go frontend for libbpf-tools.","archived":false,"fork":false,"pushed_at":"2021-11-23T18:40:38.000Z","size":13928,"stargazers_count":13,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-19T19:48:02.697Z","etag":null,"topics":["bpf","libbpf-tools"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marselester.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-13T20:04:49.000Z","updated_at":"2024-05-17T18:12:05.000Z","dependencies_parsed_at":"2022-09-15T11:13:33.607Z","dependency_job_id":null,"html_url":"https://github.com/marselester/libbpf-tools","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/marselester%2Flibbpf-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marselester%2Flibbpf-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marselester%2Flibbpf-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marselester%2Flibbpf-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marselester","download_url":"https://codeload.github.com/marselester/libbpf-tools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248324259,"owners_count":21084679,"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","libbpf-tools"],"created_at":"2025-04-11T01:27:39.694Z","updated_at":"2025-04-11T01:27:40.318Z","avatar_url":"https://github.com/marselester.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go libbpf-tools\n\nAn attempt to implement a Go frontend for\n[libbpf-tools](https://github.com/iovisor/bcc/tree/master/libbpf-tools)\nnarrated in blog posts:\n\n- [BPF: Go frontend for execsnoop](https://marselester.com/bpf-go-frontend-for-execsnoop.html)\n- [BPF: Go frontend for tcpconnect](https://marselester.com/bpf-go-frontend-for-tcpconnect.html)\n- [BPF Go program in Kubernetes](https://marselester.com/bpf-go-program-in-kubernetes.html)\n\nStart a virtual machine, install Clang and Go.\n\n```sh\n$ vagrant up\n$ vagrant ssh\n$ sudo apt-get update\n$ sudo apt-get install clang\n$ sudo snap install go --classic\n$ uname -nr\nubuntu-groovy 5.8.0-53-generic\n$ clang -v\nUbuntu clang version 11.0.0-2\n```\n\nCompile C BPF program into BPF bytecode and generate Go files\nwith [bpf2go](https://github.com/cilium/ebpf/blob/master/cmd/bpf2go/doc.go) tool.\n\n```sh\n$ cd /vagrant/\n$ BPF_CFLAGS='-D__TARGET_ARCH_x86' go generate ./cmd/tcpconnect/\n$ sudo go run ./cmd/tcpconnect -timestamp -print-uid\nTIME(s)  UID   PID    COMM         IP SADDR            DADDR            DPORT\n0.000    1000  240332 curl         6  ::1              ::1              8000\n3.079    1000  240334 curl         4  127.0.0.1        127.0.0.1        8000\n```\n\nNote, the headers were copied from the following sources.\n\n```sh\n$ git clone git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/groovy\n$ cp ./groovy/tools/lib/bpf/bpf_helpers.h ./headers/bpf\n$ cp ./groovy/tools/lib/bpf/bpf_core_read.h ./headers/bpf\n$ cp ./groovy/tools/lib/bpf/bpf_tracing.h ./headers/bpf\n$ git clone https://github.com/libbpf/libbpf.git\n$ cp ./libbpf/src/bpf_helper_defs.h ./headers/bpf\n```\n\n`vmlinux.h` was generated as follows.\n\n```sh\n$ sudo apt-get install linux-tools-common linux-tools-5.8.0-53-generic\n$ bpftool btf dump file /sys/kernel/btf/vmlinux format c \u003e ./headers/vmlinux.h\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarselester%2Flibbpf-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarselester%2Flibbpf-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarselester%2Flibbpf-tools/lists"}