{"id":13436968,"url":"https://github.com/lizrice/libbpfgo-beginners","last_synced_at":"2025-04-07T11:06:11.168Z","repository":{"id":44356676,"uuid":"332032219","full_name":"lizrice/libbpfgo-beginners","owner":"lizrice","description":"Basic eBPF examples in Golang using libbpfgo","archived":false,"fork":false,"pushed_at":"2024-02-22T19:46:09.000Z","size":28,"stargazers_count":244,"open_issues_count":4,"forks_count":59,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-03-31T09:06:05.314Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lizrice.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-22T18:37:52.000Z","updated_at":"2025-02-12T19:10:10.000Z","dependencies_parsed_at":"2024-01-23T18:12:59.791Z","dependency_job_id":"0aa94753-3f99-4e51-8c3f-98f1dedf4f0e","html_url":"https://github.com/lizrice/libbpfgo-beginners","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/lizrice%2Flibbpfgo-beginners","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lizrice%2Flibbpfgo-beginners/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lizrice%2Flibbpfgo-beginners/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lizrice%2Flibbpfgo-beginners/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lizrice","download_url":"https://codeload.github.com/lizrice/libbpfgo-beginners/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247640462,"owners_count":20971557,"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":[],"created_at":"2024-07-31T03:00:53.390Z","updated_at":"2025-04-07T11:06:11.144Z","avatar_url":"https://github.com/lizrice.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# libbpfgo-beginners\nBasic eBPF examples in Golang using [libbpfgo](https://github.com/aquasecurity/tracee/tree/main/libbpfgo). \n* Accompanying [slides from my talk at GOTOpia 2021](https://speakerdeck.com/lizrice/beginners-guide-to-ebpf-programming-with-go) called Beginner's Guide to eBPF Programming in Go\n* See also my [original Python examples](https://github.com/lizrice/ebpf-beginners) from my [Beginner's Guide to eBPF talk](https://speakerdeck.com/lizrice/liz-rice-beginners-guide-to-ebpf)  \n\n## Install Go \n\nSee [the Go documentation](https://golang.org/doc/install)\n\n## Install packages\n\n```sh\nsudo apt-get update\nsudo apt-get install libbpf-dev make clang llvm libelf-dev\n```\n\n## Building and running hello\n\n```sh\nmake all\nsudo ./hello\n```\n\nThis builds two things:\n* dist/hello.bpf.o - an object file for the eBPF program\n* hello - a Go executable\n\nThe Go executable reads in the object file at runtime. Take a look at the .o file with readelf if you want to see the sections defined in it.\n\n## Docker\n\nTo avoid compatibility issues, you can use the `Dockerfile` provided in this repository.\n\nBuild it by your own:\n\n```bash\ndocker build -t hello .\n```\n\nAnd the run it from the project directory to compile the program:\n\n```bash\ndocker run --rm -v $(pwd)/:/app/:z hello\n```\n\n## Notes \n\nI'm using Ubuntu 20.10, kernel 5.8, go 1.15\n\nThis approach installs the libbpf-dev package. Another alternative (which is what [Tracee](https://github.com/aquasecurity/tracee) does) is to install the [libbpf source](https://github.com/libbpf/libbpf) as a git submodule, build it from source and install it to the expected location (e.g. `/usr/lib/x86_64-linux-gnu/libbpf.a` on an Intel x86 processor).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flizrice%2Flibbpfgo-beginners","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flizrice%2Flibbpfgo-beginners","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flizrice%2Flibbpfgo-beginners/lists"}